web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Update BPF active stage programmatically with EntityLogicalName: businessprocessflowinstance

(0) ShareShare
ReportReport
Posted on by 44

Hi all,

i'm triyng to update the active stage of an Opportunity in the BPF after clicking the button (in c#), i'm doing it by following the sample here: https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/sample-work-business-process-flows 

I'm having issue with the method:

Entity retrievedProcessInstance = crmSvc.Retrieve("businessprocessflowinstance", processOpp1Id, cols1);

Here's the error:

System.ServiceModel.FaultException`1: 'The 'Retrieve' method does not support entities of type 'businessprocessflowinstance'.'

Here below is the function code:

   newActiveStageId = (Guid)pathResp.ProcessStages.Entities[activeStagePosition].Attributes["processstageid"];

    // Retrieve the process instance record to update its active stage
    ColumnSet cols1 = new ColumnSet();
    cols1.AddColumn("activestageid");
    Entity retrievedProcessInstance = crmSvc.Retrieve("businessprocessflowinstance", processOpp1Id, cols1);

    // Update the active stage to the next stage
    retrievedProcessInstance["activestageid"] = new EntityReference("businessprocessflowinstance", newActiveStageId);
    crmSvc.Update(retrievedProcessInstance);

  • David Jennaway Profile Picture
    14,065 on at

    You need to replace "businessprocessflowinstance" with the name of the entity for the business process flow. For example, for the out of box 'lead to opportunity' BPF this is "leadtoopportunitysalesprocess"

  • Suggested answer
    ajyendra Profile Picture
    1,738 on at
  • Suggested answer
    ajyendra Profile Picture
    1,738 on at
  • Ryuzaki53 Profile Picture
    44 on at

    Thank you David, probably i solved the error i was having below with your suggestion, but now it's giving the error in the Update method:

    Participating entity record of stage: 650e06b4-789b-46c1-822b-0da76bedb1ed is not valid'

    I'm having some doubt about the first parameter of the new EntityReference here: 

    retrievedProcessInstance["activestageid"] = new EntityReference("opportunitysalesprocess", newActiveStageId);

    Has it to be the same as in the Retrieve?

  • Suggested answer
    ajyendra Profile Picture
    1,738 on at

    Hi,

    Try processstage in the first parameter

  • Ryuzaki53 Profile Picture
    44 on at

    Hi Ajyendra,

    I tried putting "processstage" as first parameter of that function, but the error in the Update method

    "crmSvc.Update(retrievedProcessInstance);" is still the same : 'Participating entity record of stage: xxx is not valid'

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daniyal Khaleel Profile Picture

Daniyal Khaleel 103 Most Valuable Professional

#2
11manish Profile Picture

11manish 63 Super User 2026 Season 2

#3
Travis South Profile Picture

Travis South 46

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans