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 :
Microsoft Dynamics CRM (Archived)

Not able to move the business process on to the next stage. Does not set as active

(0) ShareShare
ReportReport
Posted on by 60

Hi,

We are on premise 2016 Dynamics 365. We have an issue where we are unable to move the business process on to the next stage. It will not set as active, as below;

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Radu Chiribelea Profile Picture
    6,667 on at

    Hello,

    Do you have any logic around the business process flow (JavaScript, Plug-ins, etc.) ? If yes - if you disable them does it work?

    I've seen this type of behavior in the past also when the stageid and the stagename on the form were not set correctly (stageid belonged to the wrong stagename of the business process flow) - this in generally was caused by custom javascript / plugins

    Hope this helps,

    Radu

  • Aleia Profile Picture
    45 on at

    Hi Radu,

    We have no custom JavaScript Running;

    Thank you

  • Suggested answer
    Kokulan Profile Picture
    18,054 on at

    Could you please check your Dev tool console (F12) to see if it logs any errors when you try to set the stage?

  • Aleia Profile Picture
    45 on at

    Hi Kokulan,

    No errors or breaks when I set the stage.

  • Radu Chiribelea Profile Picture
    6,667 on at

    Can you check the stageid and the stagename against the record and see if there is any mismatch there ?

  • Aleia Stickley Profile Picture
    60 on at

    Hey,

    Firstly, thank you so much for helping me.

    They do not appear to match as would expect, how can I resolve this?

  • Suggested answer
    Radu Chiribelea Profile Picture
    6,667 on at

    You can set them via the SDK within a console application. You'd need to retrieve the associated BPF record to your entity and then set the stageid to the coresponding stage name. Something like the snippet below :  

    using System;
    using Microsoft.Crm.Sdk.Messages;
    using Microsoft.Xrm.Sdk.Client;
    using System.ServiceModel.Description;
    using Microsoft.Xrm.Sdk.Query;
    using Microsoft.Xrm.Sdk;
    using System.Collections.Generic;
    using System.Configuration;
    using Microsoft.Xrm.Tooling.Connector;
    
    namespace BPFConsoleProject
    {
        class Program
        {
    
            static void Main(string[] args)
            {
                //Where Applies, replace with your values
    
                string userName = "username@domain.com";
                string password = "password";
                string authType = "AD";
                string url = "crmserver:port/orgName";
    
                Guid recordToFixId = Guid.Parse("record Guid on which the bpf is broken");
                string recordToFixEntityName = "name of the entity against which the bpf is configured";
    
                string businessProcessFlowName = "name of your bpf";
                Guid stageToSetId = Guid.Parse("Guid of the stage name you want to set");
    
                try
                {
                    using (CrmServiceClient crmSvc = new CrmServiceClient($"UserName={userName};Password={password};AuthType={authType};Url={url}"))
                    {
                        if (!crmSvc.IsReady)
                            throw new Exception($"Unable to connect to CRM Organization Error: {crmSvc.LastCrmError} \n {crmSvc.LastCrmException}");
    
                        // 1.   Retrieve the Active Business Process Instance set against the records
    
                        RetrieveProcessInstancesRequest retrieveProcessInstancesRequest = new RetrieveProcessInstancesRequest
                        {
                            EntityId = recordToFixId,
                            EntityLogicalName = recordToFixEntityName
                        };
    
                        RetrieveProcessInstancesResponse retrieveProcessInstancesResponse =
                            (RetrieveProcessInstancesResponse)crmSvc.Execute(retrieveProcessInstancesRequest);
    
                        Guid activeProcessInstaceId = new Guid(retrieveProcessInstancesResponse.Processes.Entities[0].Id.ToString());
    
                        Console.WriteLine("Active Process stage is: " + retrieveProcessInstancesResponse.Processes.Entities[0].Attributes["processstageid"].ToString());
    
    
                        EntityReference bpfReference =
                            (EntityReference)retrieveProcessInstancesResponse.Processes.Entities[0].Attributes["processid"];
    
                        Entity processEntity = crmSvc.Retrieve(businessProcessFlowName, activeProcessInstaceId, new ColumnSet(true));
                        processEntity["activestageid"] = new EntityReference("processstage", stageToSetId);
    
                        crmSvc.Update(processEntity);
    
                        Console.Read();
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
    
        }
    }
    


    hope this helps

    Radu

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 March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans