locked
OnChange event not firing for Owner field in CRM 2011. RRS feed

  • General discussion

  • Hi,

    I am using a onchange event with just an alert to be triggered when the user changes the value in the form. The fields targeting are Regarding and Owner in the phone call activity creation. When regarding field is changed then function is getting triggered. But for the Owner it is not. Any one have an idea on this?

    We are having Rollup 13 installed.

    Regards,

    Renjith

    Thursday, July 25, 2013 12:56 PM

All replies

  • Try using fireonchange instead.

    http://msdn.microsoft.com/en-us/library/6881e99b-45e4-4552-8355-2eef296f2cd8#Y2902


    If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful" Thank you, DT

    Thursday, July 25, 2013 1:07 PM
  • This  happens not only for phonecall but any other entity also

    You can have  the  logic onsave.

    if ur condition fails abort the  save  operation like  below,

    event.returnValue = false;

    Thanks

    If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful"

    Thursday, July 25, 2013 2:56 PM
  • Thanks Tripathy and Pallavi for the response.

    I am already using fireonchange but the problem is that event itself not getting triggered. Later while testing found out that this event is getting triggered only when the form is in Create mode and I am assigning owner for the first time. If the form is in Update mode and I am trying to reassign the owner the event is not getting fired.

    Is this how its behavior is or we have any workarounds or fixes for this behavior?

    Friday, July 26, 2013 7:24 AM
  • Hi Renjith,

    I guess you might have noticed the behavior of the owner field that 

    In Create mode:

    on click of owner field gives you a look-up window which has the parent window of record being created. This will definitely give a call to your onchange/fireonchange event function of owner field. This works fine as expected.

    In Update mode:

    The control is passed to a separate crm page (assignqueue.aspx page) where it asks to assign the record to the current user or different user/team. On selection of any user and clicking ok will not trigger the onchange event of the owner field instead the save event of the record gets triggered after performing the validation checks. (This you can check by removing the value of any mandatory field on the form before changing the owner.)

    Hence you need to perform the validation on the save event (in JavaScript) or "Assign" message of the entity (in Plugin).

    I hope this clarifies your doubt about the default CRM behavior and the action to be taken.

    Thanks & Regards,

    Anubhav


    Anubhav Bajpai

    Friday, July 26, 2013 9:57 AM