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

how to catch assign event/button before saving

(0) ShareShare
ReportReport
Posted on by 645

Hi, I need to "catch" assign event before saving, the situation is that when I assign my record to an other user I need to check if the field Owner isDirty. if it's dirty the record can't be saved automatically and need to have some checks. I added my rules (if/else) to onSave event, and after clicking assign I thought the Owner field will be dirty but it return false and the record was saved... is there a way to catch the assign event or how do I stop from saving after assign and check some rules before saving?

I have the same question (0)
  • Suggested answer
    thonda Profile Picture
    Microsoft Employee on at

    Hi Sahara,

    I would say you have to depend on SaveMode value 58 and then trigger custom logic after calling preventDefault, based on your logic you may call the save and refresh asynchronously.

    https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/formcontext-data-entity/addonsave

    https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/save-event-arguments/getsavemode

    function preventAutoSave(executionContext) {

        var formContext = exeutionContext.getFormContext();
        var eventArgs = executionContext.getEventArgs();
        if (eventArgs.getSaveMode() == 58) {
            eventArgs.preventDefault();

       //do custom logic and save asynchronously , you my refresh the form from successcallback formContext.data.refresh(false)

        formContext.data.save(saveOptions).then(successCallback, errorCallback);

        }
    }

    Regards,

    Praveen T

    D365 CE Customization Support

    Microsoft Corporation

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 103 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 83

#3
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans