Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 55831

Set lookup field value

$
0
0

I'm trying to set lookup field value using javascript. My script gives me "An error has occurred. Please return to the home page and try again", but everything works well. This is my code:

var lookupVal = new Array();
    lookupVal[0] = new Object();
    lookupVal[0].id = lookup.savedEntityReference.id;
    lookupVal[0].name = lookup.savedEntityReference.name;
    lookupVal[0].entityType = "new_agreement";
    var existingValue = Xrm.Page.getAttribute("new_agreement").getValue();
    if (existingValue === null) {
        Xrm.Page.getAttribute("new_agreement").setValue(lookupVal); //error is in this row
    }

Viewing all articles
Browse latest Browse all 55831

Trending Articles