how to transfer a string field values into lookup field using javascript
*This post is locked for comments
I don't know why but someone deleted my post from this thread.
Community moderators please look into it.
Thanks a lot Mahen, It's Working .
Hello,
Assuming you are reading value from one lookup to another lookup Xrm.Page object, so it should be something like below:
function setLookup()
{
if(Xrm.Page.getAttribute("sourcelookupfield")!=null &&
Xrm.Page.getAttribute("sourcelookupfield").getValue()!=null)
{
var sourceLookup=Xrm.Page.getAttribute("sourcelookupfield").getValue();
//get details from source lookup
var lookupValue = new Array();
lookupValue[0] = new Object();
lookupValue[0].id = sourceLookup[0].id;
lookupValue[0].name = sourceLookup[0].name;
lookupValue[0].entityType = sourceLookup[0].entityType;
Xrm.Page.getAttribute("targetlookupfieldname").setValue(lookupValue);
}
}
thanks
I need to read the lookup field values set the same values into another lookup field entity using java script.
and this is my code:
entity.attributes['new_potentialcustomer'] = { id: Xrm.Page.getAttribute('sss_account').getValue()[0].id, logicalName: Xrm.Page.getAttribute('sss_account').getValue()[0].entityType, type: 'EntityReference' };
I need to read the lookup field values set the same values into another lookup field entity using xrm javascript.
and this is my code:
entity.attributes['new_potentialcustomer'] = { id: Xrm.Page.getAttribute('sss_account').getValue()[0].id, logicalName: Xrm.Page.getAttribute('sss_account').getValue()[0].entityType, type: 'EntityReference' };
Could you provide some more information what you are trying to do ??
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156