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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

Lead to Opportunity BPF stage is not moving

(0) ShareShare
ReportReport
Posted on by

Hi,

I have a requirement where I have to update the Business Process Flow real-time on changing field status selected by the user. 

The same requirement I have achieved on Opportunity entity BPF (custom BPF) and working fine. but I am getting an issue when the BPF stage moves from Lead to Opportunity after Lead qualification.

46152344.Capture.PNG

Error Status 500:

Javascript

if (optionText == "Bid Process") {   //Checking option in which BPF stage will move
if (getActiveProcess.toUpperCase() == "919E14D1-6489-4852-ABD0-A63A6ECAAC5D") //checking Lead to Opportunity BPF
{
var Stage2 = "3A275C22-FC45-4E89-97FC-41E5EC578743"; // Stage ID 
var entity = {};
entity["activestageid@odata.bind"] = "/processstages(" + Stage2 + ")";  
entity["traversedpath"] = stageId + ", " + Stage2;    // StageId is the active stage ID calling dynamically
var req = new XMLHttpRequest();
req.open("PATCH", Xrm.Page.context.getClientUrl() + "/api/data/v9.1/leadtoopportunitysalesprocesses(" + currentBPFInstanceID + ") ", true);   // here currentBPFInstanceID is process InstanceId and calling dynamically.
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("Prefer", "odata.include-annotations=\"*\"");
req.onreadystatechange = function () {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 204) {
//Success – No Return Data – Do Something
//alert("Success");
} else {
alert("Error");
//Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send(JSON.stringify(entity));
}

I have the same question (0)
  • Suggested answer
    Bipin D365 Profile Picture
    28,985 Moderator on at

    Hi,

    Only Http status 500 will not help to find out the issue.

    Could you please click on request which you highlighted in screenshot from network tab and check response details which will have detailed error details.

    Is there any reason why you are using xrmhttprequest instead of using xrm.webapi?

    var entity = {};
    entity["activestageid@odata.bind"] = "/processstages(1123)";
    entity.traversedpath = "ttt";
    
    Xrm.WebApi.online.updateRecord("leadtoopportunitysalesprocess", "00000000-0000-0000-0000-000000000000", entity).then(
        function success(result) {
            var updatedEntityId = result.id;
        },
        function(error) {
            Xrm.Utility.alertDialog(error.message);
        }
    );

    Please Mark My Answer Verified If I Were Helpful

  • Community Member Profile Picture
    on at

    Thanks Bipin for reply, As suggested by you I have update the code with Xrm.WebApi but the same error I found.

    Please check the below error Respose.

    pastedimage1597299918336v1.png

  • Community Member Profile Picture
    on at

    I have a concern that when Lead Qualified to Opportunity than the same Business Process flow work (leadtoopportunitysalesprocess) in Opportunity entity. When I have created background workflow on Lead to Opportunity BPF but the same workflow is not getting trigger. The same process is working fine when I create opportunity directly (without qualifying the lead)

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 Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Hamza H Profile Picture

Hamza H 142 Super User 2026 Season 1

#2
Nagaraju_Matta Profile Picture

Nagaraju_Matta 128

#3
ManoVerse Profile Picture

ManoVerse 127 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans