2

Resolved

Update the EntityReferenceFactory to include LogicalName

description

Hey thuld,

A suggestion for your EntityReferenceFactory method is to include the LogicalName as an optional parameter.

When creating a note I received an error as the regarding object lookup needed this attribute to be entered otherwise it would fail.

The code could be changed as follows:
function _entityReferenceFactory(id, opt_logicalName) {

    var reference = null;

    if (id !== undefined && id !== null) {
                    
        reference = {
            __metadata: { type: "Microsoft.Crm.Sdk.Data.Services.EntityReference" },
            Id: id
        };
                    
        if (opt_logicalName !== undefined && opt_logicalName !== null) {
            reference.LogicalName = opt_logicalName;
        }
    }

    return reference;
}
Hope this helps

Matt

comments

thuld wrote Mar 7, 2013 at 11:46 AM

Hi Matt,

thanks for the feedback.

Issue is solved in version 2.5 and I updated the unit-tests.

Daniel

wrote May 16, 2013 at 9:40 AM

wrote May 16, 2013 at 9:40 AM

wrote Jun 14, 2013 at 7:11 AM