locked
Fire plugin in the Onchange event of a field RRS feed

  • Question

  • Is there a way to fire a plugin in the onchange event of a field on the CRM Form??
    Santosh Kore CRM Developer
    Friday, October 16, 2009 9:34 PM

Answers

  • If you really want to do this in the onChange event of a field, your option is either to write the "plugin-code" in javascript, or to call a custom webservice from the javascript to execute the code you want.

    You will find tons of information trough a search engine on how to do this

    search string "call webservice from javascript".

    The CRM Sdk also has some samples
    Best Regards Jens Egil Evensen
    Monday, October 19, 2009 1:02 PM
  • 'call webservice from javascript' is a good solution if is possible.
    Monday, October 19, 2009 1:48 PM
  • alternatively u can call an aspx page AJAX, which can perform the logic and return true or false ...
    Sohaib Ahmad [Business Management Solution Professional] http://www.solutiontalk.blogspot.com
    Tuesday, October 20, 2009 6:05 PM

All replies

  • I don't think so.
    Why can't you add custom code into a workflow instead?
    Marco
    Friday, October 16, 2009 10:24 PM
  • The best place to put code really depends on what you're trying to do.  When you talk about using a form's onChange() event, I presume you're looking to execute some custom code every time the field changes on the UI, regardless of what value is ultimately saved to the record.  While you could trigger a Workflow execution, or even mimic a platform operation to trigger Plugin code, these options seem somewhat overzealous for data which may not be written to the record.

    Of course, if you described what you're really trying to achieve, perhaps better suggestions could be made.


    Dave Berry
    Friday, October 16, 2009 10:32 PM
    Moderator
  • If you really want to do this in the onChange event of a field, your option is either to write the "plugin-code" in javascript, or to call a custom webservice from the javascript to execute the code you want.

    You will find tons of information trough a search engine on how to do this

    search string "call webservice from javascript".

    The CRM Sdk also has some samples
    Best Regards Jens Egil Evensen
    Monday, October 19, 2009 1:02 PM
  • 'call webservice from javascript' is a good solution if is possible.
    Monday, October 19, 2009 1:48 PM
  • alternatively u can call an aspx page AJAX, which can perform the logic and return true or false ...
    Sohaib Ahmad [Business Management Solution Professional] http://www.solutiontalk.blogspot.com
    Tuesday, October 20, 2009 6:05 PM