Skip to main content

Notifications

Announcements

No record found.

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);

  • Ryuzaki53 Profile Picture
    44 on at
    RE: Update BPF active stage programmatically with EntityLogicalName: businessprocessflowinstance

    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'

  • Suggested answer
    ajyendra Profile Picture
    1,738 on at
    RE: Update BPF active stage programmatically with EntityLogicalName: businessprocessflowinstance

    Hi,

    Try processstage in the first parameter

  • Ryuzaki53 Profile Picture
    44 on at
    RE: Update BPF active stage programmatically with EntityLogicalName: businessprocessflowinstance

    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
    RE: Update BPF active stage programmatically with EntityLogicalName: businessprocessflowinstance

    Hi Ryuzaki53,

    May this blog help you

    www.magnetismsolutions.com/.../programmatically-move-cross-entity-business-process-flow-stages-in-crm-2016

  • Suggested answer
    ajyendra Profile Picture
    1,738 on at
    RE: Update BPF active stage programmatically with EntityLogicalName: businessprocessflowinstance

    Hi Ryuzaki53,

    May this blog help you

    www.magnetismsolutions.com/.../programmatically-move-cross-entity-business-process-flow-stages-in-crm-2016

  • David Jennaway Profile Picture
    14,065 on at
    RE: Update BPF active stage programmatically with EntityLogicalName: businessprocessflowinstance

    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"

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 78 Super User 2025 Season 1

#3
Sahra Profile Picture

Sahra 43

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans