Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

setActiveStage

(0) ShareShare
ReportReport
Posted on by 179

hi ,

I have BPF with  5  stages

i want to set active the last stage but i get (Invalid Error)

there is my script

Xrm.Page.data.process.setActiveStage(GUID, function(result) {
if(result == "success") {
    alert("Success");
} else {
    alert("Invalid");
}
});

Thank you

*This post is locked for comments

  • Suggested answer
    gdas Profile Picture
    50,089 Moderator on at
    RE: setActiveStage

    Hello ,

    Please check below reference  - this will help you  to understand completely about the method setActiveStage .

    msdn.microsoft.com/.../dn817878.aspx

    setactivestage.png

  • CrmMouss Profile Picture
    179 on at
    RE: setActiveStage

    How can i save all completed stages ?

  • Suggested answer
    gdas Profile Picture
    50,089 Moderator on at
    RE: setActiveStage

    Hi ,

    When process was in stage 3 you can do this as the process is already completed  and saved , try to save all completed stages and then make setActiveStage.

  • CrmMouss Profile Picture
    179 on at
    RE: setActiveStage

    hi Goutam thank you for reply

    my stageid exists , but i don't understand (may be  active stage has not been selected)

    what is the difference between active stage and selected stage )?

  • CrmMouss Profile Picture
    179 on at
    RE: setActiveStage

    Hi aric

    the other stages are completed , so i don't know whey i get error

    because when the process was in stage 3 and i set Stage 1 or Stage 2 by js  it works

  • Suggested answer
    gdas Profile Picture
    50,089 Moderator on at
    RE: setActiveStage

    Hi,

    Few things need to check before doing setActiveStage -

    Make sure you are doing Active stage only completed stage and the selected stage must be the active stage.

    As far as I know Invalid error occur due to either a stageid which you are providing is not exist and may be  active stage has not been selected, or the record is not yet saved.

    Hope this helps.

  • Aric Levin Profile Picture
    30,188 Moderator on at
    RE: setActiveStage

    What I said is that you might have to set all the previous stages before your set stage 5.

    There are conditions that will not allow you to go from Stage 1 to stage 5 without completing the previous stages.

  • CrmMouss Profile Picture
    179 on at
    RE: setActiveStage

    Thank you for reply

    I have my process with five stages

    Stage1 -- stage 2 -- stage 3 -- stage 4 -- stage 5

    when i load form i want set active the stage 5

    but the method Xrm.Page.data.process.setActiveStage  retun Invalid result

  • Suggested answer
    Aric Levin Profile Picture
    30,188 Moderator on at
    RE: setActiveStage

    What is the exact error that you are getting and from what stage are you trying to set the Active Stage?

    I think that if you want to move to the last stage, you need to call the setActiveStages for each stage that you are skipping.

    As an alternative you can also use Dynamics 365 Workflow Tools to set the process stage to the final stage.

    github.com/.../Dynamics-365-Workflow-Tools

    Hope this helps.

  • CrmMouss Profile Picture
    179 on at
    RE: setActiveStage

    for information this code is called in  onload  action

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,865 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,723 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans