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

custom workflow updates text field

$
0
0

Hi, I am looking to update a text field through a output parameter from a custom workflow, but my code didn't work as expected, it didn't update at all, and when tracing the value, it shows "System.Activities.OutArgument`1[System.String]",  please advise.

[Input("Input Entity")]
        [RequiredArgument]
        [ReferenceTarget(Invoice.EntityLogicalName)]
        public InArgument<EntityReference> InputEntity { get; set; }
        [Output("Check Payment")]
        [Default("No Payment Item")]
        public OutArgument<string> checkpayment { get; set; }
ITracingService tracingService = executionContext.GetExtension<ITracingService>();
            //Create the tracing service
            ITracingService tracingService = executionContext.GetExtension<ITracingService>();
            //Create the context
            IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
            IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
            decimal result = 0;

            if (crmWorkflowContext == null)
            {
                throw new ArgumentNullException("crmWorkflowContext");
            }

	        try
	        {
                //get old invoice id
                if (this.InputEntity.Get(executionContext).Id == null)
                {
                    throw new InvalidPluginExecutionException("Failed to retrieve invoice id.");
                }
                using (CrmServiceContext csc = new CrmServiceContext(service))
                {
                    if (csc.recoserv_paymentitemSet.Where(x => x.recoserv_invoice.Id == this.InputEntity.Get(executionContext).Id).ToList().Count== 0)
                    {
                        this.checkpayment.Set(executionContext, "no");
                        throw new InvalidPluginExecutionException(this.checkpayment.ToString());
                    }
                }



Viewing all articles
Browse latest Browse all 46379

Trending Articles



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