locked
onChange event after record creation on custom entities cannot access record id GUID via XRM RRS feed

  • Question

  • I have a custom field on a custom entity with a default value, i.e. 'false'. If during the save, the plugin changes the value to 'true', the onchange event fires triggering JavaScript code. the JS code needs to get the GUID of the current record to pass it to another SDK call for further processing.

    this works great on Updates to existing records, on either standard (Contact) and custom entities. However, in a scenario involving new records, the Contact form still returns the GUID of the new record in the JS code. But when running the scenario with a custom entity, the XRM call returns null for the GUID on the same post Create onChange event. 

    The Xrm call is the following:

    Xrm.Page.data.entity.getId()

    for a workaround, i have tried manually updating another custom field with the record id and putting it on the form. unfortunately, the refresh of the fields on the form has not occurred by the time the onChange event has fired.

    has anybody run into this issue and are there any other work-arounds?

    Monday, February 27, 2017 2:58 PM