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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

How to prevent the Save Functionality after clicking on Save button using Plugin and create a New record with the Updated Deatils

(0) ShareShare
ReportReport
Posted on by 340

Hi Team,

I have a requirement which i need to be done by Plugin.

There have a Account Record and when i open that Account Record and modify some of the fields and click on Save then the Record should not gets Saved.

Instead it shows Some Custom Message that " New record gets Created" and create a New Record with that updated details.

I need to do this using Plugin. Can anybody give me any solution that how should i proceed and achieve the same.

Thanks in Advanced.

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

    Hi,

    Do you really need to do this by plugin? I know that with javascript this is achievable, by plugin I don't think so.... Unless you throw an exception on plugin, on pre update event (but this is not a very "pretty" solution, neither throwing an exception).

  • Suggested answer
    Kipetcoff Profile Picture
    1,037 on at

    Hi,

    As I know you can just throw exception in Update or Create event.

      throw new InvalidPluginExecutionException("The record can't be saved")

  • Suggested answer
    DynamicsAlex Profile Picture
    25 on at

    You can achieve this by blocking the save (onSave javascript handler) and invoking a custom Action with a plugin attached to create the record, passing all the account fields to the Action. After the action completes and you are back in your JS you can display the alert and/or navigate to the new record.

    On a side note, this sounds like an excellent way of filling up the accounts with a boatload of duplicates, each differing by only a typo and devoid of any value. If I were you I'd prepare to delete and rework the whole thing in a matter of weeks.

  • Suggested answer
    Saad Kabarousse Profile Picture
    734 on at

    Hello,

    you can use this :

    1- Create a javascript funtion

    2- pass to it the execution context as shown below

    pastedimage1571409764139v1.png

    3- Associate your function to Onsave event

    4- execContext.getEventArgs().preventDefault(); // To Prevent the Form Save

    Hope this helps

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 61

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 52 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans