Notifications
Announcements
No record found.
Hi guys
please tell me how to stop a save and show a javascript alert from a pre-stage plugin.
Thanks in Advance,
Lasa
*This post is locked for comments
hi,You can throw exception from your plugin.
throw
this will stop save&close operation and show text "Message text" in dialog box.
Hi Dusan,you are right but there are some other probs with this solution, lets say i wanna continue with the save and then show an alert.Problem is when you throw this exp after an insert and then try to save again (hit save again after the popup from the same screen) it actually inserts duplicate records. so im just wondering whether theres other ways of accomplishing this.
Regards,
Your best course of action here is to use a plug-in, some OnLoad() javascript and a couple attributes.
1. Create 2 attributes: new_showerror (bit), new_error(nvarchar or ntext)
2. If your plug-in encounters an error populate these 2 fields as part of the PreCreate or PostCreate plug-in, depending on when you want it to fire.
3. In the OnLoad()
if(crmForm.FormType == 1) && (crmForm.all.new_showerror.DataValue == true){//Then use window.alert or window.confirm to display the message.//Once the alert is acknowledged or the confirm dialog is acted upon you can then set the new_showerror to false which will prevent the alert from showing back up the next time the form is loaded.}
Hi Jeremy,
thats exactly what i ended up doing, I dont think theres any other way to accomplish this.
Also i had to update the obj from the plugin in order to set the error msg.
Hi,
We can throw an exception and display a message.
throw new InvalidPluginExecutionException("Message here....");
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2