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 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.

I have the same question (0)
  • Suggested answer
    Jomy Jose Profile Picture
    290 on at

    Please refer below link, Hope this helps.

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

  • Suggested answer
    sdfasdf Profile Picture
    842 on at

    Hi,

    The SetProcess action has been deprecated: https://docs.microsoft.com/en-us/power-platform/important-changes-coming#legacy-process-related-attributes-in-entities-are-deprecated

    This article, however, describes the procedure for you to programmatically change the process associated with any given record: https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/model-business-process-flows#create-retrieve-update-and-delete-business-process-flow-entity-records-process-instances

    Hope it helps.

  • Maulik Lakhani Profile Picture
    94 on at

    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.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 94 Super User 2026 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

#3
11manish Profile Picture

11manish 68

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans