locked
CRM Online, Add onChange event handler for fields in Business Process Flow RRS feed

  • Question

  • Hi,

    In CRM 2015 Online, I notice that there is no out-of-box onChange event handler for fields in Business Process Flow.  So, I will have to programmatically add it to the field I need it to handle value change.  In my case, my field to add onChange is a lookup field.  Of course, I look for a solution in general.  Thanks.

    Tuesday, April 5, 2016 12:45 AM

Answers

  • Hi,

    Depending on what you want to achieve you could use businesses rules. 

    If not you can add the field you require an on change event on to a section on the form and hide it.

    Alternately you can use Xrm.Page.getAttribute("fieldname").addOnChange(function) to set your on change events programmatically off of the OnLoad event.

     

    William

    • Marked as answer by chicago bq Tuesday, April 5, 2016 5:00 PM
    Tuesday, April 5, 2016 2:42 AM

All replies

  • Hi,

    Depending on what you want to achieve you could use businesses rules. 

    If not you can add the field you require an on change event on to a section on the form and hide it.

    Alternately you can use Xrm.Page.getAttribute("fieldname").addOnChange(function) to set your on change events programmatically off of the OnLoad event.

     

    William

    • Marked as answer by chicago bq Tuesday, April 5, 2016 5:00 PM
    Tuesday, April 5, 2016 2:42 AM
  • Hi, William-

    Thank you for providing not only one solution, instead, many.  I thought about adding the field as hidden field on the form.  The drawback is it is too easy for another developer or administrator to remove the hidden field later thinking it is a unneccesary field.  Then, the function will be broken.

    However, because the programmatical way, xxx.addOnChange(function) in javascript, does not work, adding the hidden field is the just-for-now choice for me, even though I prefer the programmatical solution.  Thanks a lot.

    Tuesday, April 5, 2016 5:11 PM