Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

Set two date field value

$
0
0

Hi

in a form i have date(today date) and a delay (Whole Number) and a NextDate (=Today + delay)

i want to get just the delay from the user and set the others automatically

Here is My code:

        [Input("Delay")]
        [Default("12")]
        public InArgument<double> Delay { get; set; }


        protected override void Execute(CodeActivityContext executionContext)
        {
            IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
            IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

            
            Entity ent = new Entity("bartar_callcenterreport");
            ent.Id = Delay.Get(executionContext).Id; 
            int delay = (int)Delay.Get(executionContext);
            ent["bartar_date"] = DateTime.Today;
            ent["bartar_nextcall"] = DateTime.Today.AddDays(delay);
            service.Update(ent);


But it gives error that update needs id, and I dont know how to get id of the current record.


Viewing all articles
Browse latest Browse all 79901


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>