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

Update the Opportunity Stage in ASP.NET

$
0
0

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.


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images