locked
CRM 4: execute plugin while changing the value of a field RRS feed

  • Question

  • Hi all,

     

    Is there anyway to execute plugin while changing the value of a lookup field ??

     

    thanks in advance..

    Tuesday, July 5, 2011 12:16 PM

Answers

  • If you register your plugin on the "update" message and select the lookup attribute in the filtering attributes then it will trigger each time you update the lookup value.

    There are some special lookups like "owner" which work different though.


    Gonzalo | gonzaloruizcrm.blogspot.com

    Tuesday, July 5, 2011 1:18 PM
    Moderator

All replies

  • Hi,

     

    I dont think this is possible but what you could do is call the CRM service to or a custom service to trigger the same logic as the plugin.

     

    Cheers


    Andrew Mackay (http://www.twitter.com/mistophiles)
    Tuesday, July 5, 2011 12:37 PM
  • If you register your plugin on the "update" message and select the lookup attribute in the filtering attributes then it will trigger each time you update the lookup value.

    There are some special lookups like "owner" which work different though.


    Gonzalo | gonzaloruizcrm.blogspot.com

    Tuesday, July 5, 2011 1:18 PM
    Moderator
  • Dear Gonzalo,

     

    I need to trigger the plugin each time I change the value of a lookup field, but before saving the record (something similar to the onChange event)

    Is that what you mean ??

    Tuesday, July 5, 2011 1:21 PM
  • No in that case you must use onChange event JS since the call never makes it to the server you must call code from the client using JS.

    Gonzalo | gonzaloruizcrm.blogspot.com

    Tuesday, July 5, 2011 1:40 PM
    Moderator
  • Dear Gonzalo, thanks alot for your help

    most probably, I'll do this, but I was thinking that there is some way to trigger the plugin while changing field value instead of developing the same logic again in JS, as the plugin is already registered to trigger on Update

    Tuesday, July 5, 2011 1:47 PM
  • Hi Mostafa,

    You can leave the plugin filtering option to null and check if Input Plugin Entity image (in context.InputParameters["Target"]) contains the attributes in the if condition then execute your logic. On Update message CRM will only pass the updated attributes in the entity image.


    Jehanzeb Javeed

    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    Tuesday, July 5, 2011 1:53 PM