Quantcast
Channel: CRM Development Forum
Viewing all articles
Browse latest Browse all 888

creating the partylist through javascript in the appointment requiredattendees field

$
0
0

Dear all ;

i am trying to create party list in the requiredattendees field of appointment through java script it is creating the party list but the last value of the partylist here is my code

    

if(Xrm.Page.getAttribute("requiredattendees").getValue()!=null)
{

 var party = Xrm.Page.getAttribute("requiredattendees");
    var partyList = party.getValue();

    for (var idx = 0; idx < partyList.length; ++idx)
    {

        var activityParty = new Object();
        activityParty.PartyId = { Id: partyList[idx].id, LogicalName:partyList[idx].entityType  };
        activityParty.ActivityId = { Id: chk.ActivityId, LogicalName: "appointment" };
        activityParty.ParticipationTypeMask = { Value: 5 };
createEntity(activityParty, "ActivityParty", "");
    }
}

function createEntity(ent, entName, upd) {
            
            var jsonEntity = JSON.stringify(ent);
            var createEntityReq = new XMLHttpRequest();
            var ODataPath = Xrm.Page.context.getServerUrl() + "/XRMServices/2011/OrganizationData.svc";
            createEntityReq.open("POST", ODataPath + "/" + entName + "Set" + upd, false);
            createEntityReq.setRequestHeader("Accept", "application/json");
            createEntityReq.setRequestHeader("Content-Type", "application/json; charset=utf-8");
            createEntityReq.send(jsonEntity);
            var newEntity = JSON.parse(createEntityReq.responseText).d;



            return newEntity;
        }


Viewing all articles
Browse latest Browse all 888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>