locked
Set the Partylist value using array in JavaScript RRS feed

  • Question

  • 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.

    Wednesday, June 10, 2015 10:01 AM

Answers

  • Hi,

    javascript is case sensitive, so you need to write indxIds with the I.

    in addition you need to use entityType and not typename

    //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].entityType = 'contact'; 		
    }
    Xrm.Page.getAttribute("to").setValue(partyList);


    My blog: www.crmanswers.net - CRM Theme Generator

    • Proposed as answer by Guido PreiteMVP Wednesday, June 10, 2015 10:34 AM
    • Marked as answer by Ali Mohsin_ Wednesday, June 10, 2015 10:42 AM
    Wednesday, June 10, 2015 10:34 AM