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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Asynchronous call issue in JavaScript when click SAVE&CLOSE

(0) ShareShare
ReportReport
Posted on by 522

Hi Team,

Asynchronous call from JavaScript not working in when user clicked on SAVE&CLOSE.
But working fine on SAVE cliked.
The issue is when user clicked SAVE&CLOSE whole browser closed and hence callback function not executing.
I need to do only in javascript not in workflow/plugin.

Any help is appreciated.

Thanks in Advance,
Nausher

*This post is locked for comments

I have the same question (0)
  • gdas Profile Picture
    50,091 Moderator on at

    Hi ,

    Try with this  -

    function onSaveFn(executionContext)
    {
        var formContext = executionContext.getFormContext();
        formContext.data.save(saveOptions).then(successCallback, errorCallback);
    
    }
    
    function successCallback()
    {
    
        //Do Async call 
    }
    
    function errorCallback()
    {
    
        // restrict window close for any error 
     
    }

    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data/save

    In addition you can also use setTimeout .

  • Nausher Sayeed Profile Picture
    522 on at

    Hi Goutam,

    I don't want user to wait for completion of asynchronous call. I am already aware of the callback way to execute after saving.

    Thanks

  • gdas Profile Picture
    50,091 Moderator on at

    Can you please share your code .

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    You can use approach similar to one I described in my post - butenko.pro/.../cancelling-save-based-on-the-result-of-async-operation but the difference will be that you will allow the save operation in the callback.

    Good luck.

  • Suggested answer
    Nausher Sayeed Profile Picture
    522 on at

    Thanks all for your reply. The only way i found to implement this create asynchronous plugin.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans