locked
CRM 2011 - Prevent Plugin from triggering depending on specific form used by user RRS feed

  • Question

  • Is there a way to prevent logic in a plugin from occurring if a user makes an update to a field using a particular form?

    We have entities with two instances of a form. The normal one where javascript resides etc and an admin form visible only to those of specific security role.  If an update takes place on the admin form we would like to restrict some plugin logic that occurs post update of the entity.


    Rob

    Tuesday, April 4, 2017 3:51 PM

All replies

  • Hi Rob,

    Plugin does not understand what happens in client side. If a field is updated it will trigger. But there are few workarounds to achieve your requirement.

    1.        In the plugin you can check the user’s security roles and if they contain one of those specific roles you have mentioned you can avoid your logic from executing. This is more cleaner way of doing this.
    2.        Other way to achieve this is create a hidden field and using JavaScript set a value for this if your update has happened via the admin form script. (Simply add your script to the admin form only.) Then in your plugin check this hidden field and based on its value you can determine your logic.

    Thanks


    Sachith Chandrasiri

    Tuesday, April 4, 2017 11:23 PM