JavaScript Upgrade Gotcha #1: The .id property

Consider this code segment:

var oField = executionObj.getEventSource();

if (oField.id == "new_field1" || oField.id == "new_field2") {
    // do something
}

This uses the JavaScript .id property to retrieve the field name. Since this type of code can represent both form controls as well as data items (from SOAP or REST calls), it would be very difficult to convert automatically. This leaves us with a manual conversion requirement.

This is what the code should look like after the conversion:

var oField = executionObj.getEventSource();

if (oField.getName() == "new_field1" || oField.getName() == "new_field2") {
    // do something
}

Need help with your JavaScript upgrade to Dynamics CRM 2011 and 2013?

See what Transformer! for Dynamics CRM can do for you.

1 Comment
Leave a Reply