web
You’re offline. This is a read only version of the page.
close
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);

I have the same question (0)
  • 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 72 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 29 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans