I'm trying to set the value of the partylist from an array, which formatted from selected contacts. But I got exception indxIds is undefined, tried a lot to figure it out but couldn't do so. Here is in the following what I'm trying to do:
//arrIds is the array of guids of selected contacts
var partyList = new Array();
for (var indxIds = 0; indxIds < arrIds.length; indxIds++) {
partyList[indxIds ] = new Object();
partyList[indxIds].id = arrIds[indxids];
partyList[indxIds].name = selectedname[indxids].Name;
partyList[indxIds].typename= 'contact';
}
Xrm.Page.getAttribute("to").setValue(partyList);
I need your kind help where I'm doing wrong.
Javascript is case-sensitive, so
indxIds
andindxids
are considered 2 different variables.You are defining
indxIds
in yourfor
loop, but usingindxids
(which isundefined
) to index yourarrIds
andselectedname
arrays.In addition Dynamics CRM lookups require
entityType
and nottypename
Try:
or even better, you can use an object literal: