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 using C#

(0) ShareShare
ReportReport
Posted on by 94

I want to update business process flow on create of case.

i tried with below code but not working.

SetProcessRequest request = new SetProcessRequest();
request.Target = new EntityReference("incident", incidentId);
request.NewProcess = new EntityReference("workflow", ((EntityReference)bpf.Value).Id);

SetProcessResponse setResponce = (SetProcessResponse)organizationService.Execute(request);

and

                        SetProcessRequest setRequest = new SetProcessRequest
                        {
                            Target = new EntityReference("incident", incidentId),
                            NewProcess = new EntityReference("workflow", ((EntityReference)bpf.Value).Id)

                        };
                        SetProcessResponse setResponce = (SetProcessResponse)organizationService.Execute(setRequest);

but both are not working please help.

Thanks in Advance.

  • Maulik Lakhani Profile Picture
    94 on at
    RE: Update BPF using C#

    Hi Nathan,

    Thanks for the reply.

    i refer and implement as Microsoft suggest  docs.microsoft.com/.../model-business-process-flows

    but at the end when our code run before that system run his $batch for create instance on entity so we can not set BPF successfully because at that time 2 instance created for case record and system generated record always execute first.

    we also try to pass processid (Guid.Empty / BPF Id) on Pre-Validation and Pre-Oprration as mention in document but it will always trigger system BPF Id also not able to set Blank or empty.

    pastedimage1595827543762v1.png

    Please find below screenshot where we can set empty processid then also it will set system BPF at the place of guid.empty also we try to set BPF id but then also it will empty on create.

  • Suggested answer
    sdfasdf Profile Picture
    840 on at
  • Suggested answer
    Jomy Jose Profile Picture
    290 on at
    RE: Update BPF using C#

    Please refer below link, Hope this helps.

    sairampamidimscrm.blogspot.com/.../switch-bpf-using-c-code-in-ms-crm.html

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
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 95

#3
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 82 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans