Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Unable to prevent save in CRM 2016 using turbo forms.

(0) ShareShare
ReportReport
Posted on by

Hi 

i'm facing an issue with preventing save on turbo form in CRM 2016 on premise 8.2

i'm using the following code to prevent save

function onSave(context) {    

       if(profile==null))

{

           context.getEventArgs().preventDefault();

       }

   }

I'm not getting any error but when i click on save and close it is closing form

Please help me in sorting out this issue

Thanks

Karthik

*This post is locked for comments

  • RE: Unable to prevent save in CRM 2016 using turbo forms.

    Hi Nadeeja,

    Thanks for your reply. profile is just a value we are getting  from a field which was declared globally so based on its value we are entering into if condition and doing the below code to prevent save event

    context.getEventArgs().preventDefault();

    The code suggested by you is the same which i'm using and mentioned on above question

    try to help me in providing alternate solution

    Actually issue is with turbo forms if i disable the turbo form the code is working

    so the issue is with turbo forms.

  • Suggested answer
    Nadeeja Bomiriya Profile Picture
    Nadeeja Bomiriya 6,804 on at
    RE: Unable to prevent save in CRM 2016 using turbo forms.

    Hi karthikcooool,

    What is profile?

    Try below code and see if the alert() comes up and also prevents saving.

    function onSave(context) { 
    alert("I am going to cancel the save"); context.getEventArgs().preventDefault(); }


  • RE: Unable to prevent save in CRM 2016 using turbo forms.

    Hi Karan,

    Thanks for your reply but the thing is not with the profile. it getting inside the if condition and passing the context.getEventArgs().preventDefault(); but it is not preventing the save. The same code is working in Normal forms but after enabling the Turbo FORM it stopped working.

  • Suggested answer
    RE: Unable to prevent save in CRM 2016 using turbo forms.

    Please tell me the type of the field, I can adjust your code.

    Regards, Karan

  • Suggested answer
    RE: Unable to prevent save in CRM 2016 using turbo forms.

    Hi Karthik,

    you don't have a check for profile. Please get first the value and put it in a variable in order to have a check like:

    var profile = Xrm.Page.getAttribute(“yourField”).getValue();

    Regards, Karan

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,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans