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 365 | Integration, Dataverse...
Suggested Answer

Event on Switch BPF through Switch process button

(0) ShareShare
ReportReport
Posted on by 15

I have multiple BPF's for a entity. I have events registered onStageChange  & onStageSelected of the BPF. These function are written on the onload block of the JS. 

I can switch the BPF using the Switch Process ribbon button. When I switch the process then the onload block executes and sets the field value of a custom field but it is not saved . It gets reflected as unsaved changes. There is a custom function which sets the value of that custom field but it doesn't save the value.  The value is only saved only after explicitly saving the form. 

If I would explicitly save the form in the custom function it would again call the function which is registered on onSave event. 

Any suggestions /approaches to overcome the issue of unsaved changes on BPF switch.

Thanks in advance!

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Shrivesh Tatte,

    Please try these ways:

    1. Still save the form in the custom  function but you need to pass the saveOptions parameter in which you need to customize a save mode number(Please don't use the number in this list) to the formContext.data.save() function. Something like this:

    //customize a SaveMode number
    formContext.data.save({"saveMode":71});

    Then in your onSave event, please add these lines to make your business not executed:

    function onSave(executionContext){
        var saveMode = executionContext.getEventArgs().getSaveMode();
        if(saveMode == 71){
             return;
        }
        //your business
        ...
    }

    This way would still trigger the onSave event.

    2. Don't use formContext.data.save() in your custom function. Instead, use Web API to update your current record and invoke the formContext.data.refresh(false) function in the success callback function to refresh the data. This way wouldn't trigger the onSave event.

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 365 | Integration, Dataverse, and general topics

#1
11manish Profile Picture

11manish 160

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 65 Super User 2026 Season 1

#3
ManoVerse Profile Picture

ManoVerse 51 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans