3
votes

I have a plugin registered on the Update of account fields. Whenever the user updates the parent account record,this Plugin updates all child contacts. The user would like to see a pop up (Confirmation) message stating "All child Contacts are about to be updated". When the user clicks Cancel, no update should happen.

The following are my questions reg the same:

  1. What would be the best way of doing it?
  2. Is it possible to show an alert message from a plugin in the first place?
  3. Knowing JavaScript's onsave is one of the options, can it prevent the registered plugin from firing?

Note. Whenever a Contact record is created with the parent customer field in place, I have a workflow which updates the fields of the contact with the parent account fields. Also a JavaScript to populate the fields automatically on contact form when a parent customer (Account) is chosen is in place.

Also is there a way of obtaining the field values before and after update of address fields on "On Save" of the form? Am asking this cos I would have to display the pop up if and only if there is an update of Address fields on the Account record?

1
+ 1 for well-formulated question. Should be +2 for good research prior to asking.Konrad Viltersten

1 Answers

3
votes
  1. The easiest way to achieve that would be not using a plugin. General rule of thumb is that if a task requires an user interaction (operation is on GUI level), one should go with this dreadful thing called JavaScript.

  2. Yes, but not the way you think. You can crash the execution by throwing an exception and under certain circumstances you'll get an error message. It isn't a way to go. Ever.

  3. Not sure if it's the best solution to try to stop a plugin at all. My suggestion would be adding a hidden field that is set to whatever the user decided. In the plugin (that fires every time), you'll just check the value of the field and stop/proceed accordingly.

Own suggestion:
Why not let the said field be displayed? That way, the user gets a warning but also is able to set it at their own convenience. Of course it would require the extra logic of checking if the field has been changed in order to determine whether to display the alert or not.