Hi all,
I'm having some problems with the updating of the value of the stages of an Opportunity.
I' m following the sample here: https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/sample-work-business-process-flows
Here's the code
activeStageId = (Guid)pathResp.ProcessStages.Entities[activeStagePosition 1].Attributes["processstageid"]; // Retrieve the process instance record to update its active stage ColumnSet cols1 = new ColumnSet(); cols1.AddColumn("activestageid"); Entity retrievedProcessInstance = crmSvc.Retrieve(procInstanceLogicalName, processOpp1Id, cols1); // Update the active stage to the next stage retrievedProcessInstance["activestageid"] = new EntityReference(ProcessStage.EntityLogicalName, activeStageId); crmSvc.Update(retrievedProcessInstance); // Retrieve the process instance record again to verify its active stage information ColumnSet cols2 = new ColumnSet(); cols2.AddColumn("activestageid"); Entity retrievedProcessInstance1 = crmSvc.Retrieve(procInstanceLogicalName, processOpp1Id, cols2); EntityReference activeStageInfo = retrievedProcessInstance1["activestageid"] as EntityReference; if (activeStageInfo.Id == activeStageId) { activeStageName = activeStageInfo.Name; }
By the way, I'm having at least 2 problems:
1. The ProcessStage class, gives me an error, and I don't know how should I fix;
2. the method: crmSvc.Retrieve(procInstanceLogicalName, processOpp1Id, cols1); gives me an exception: System.ServiceModel.FaultException`1
Thanks for any helps.