Archive

Archive for May 2, 2012

Limitation of OData End Point – Setting Activity Parties

Hi,

In one of my requirement, I had to create an “Appointment” record programmatically using Jscript by populating field ‘required attendees’ (i.e., ActivityParty) to it.

I followed below steps to complete the requirement

  • Created the “Appointment” record first
  • Added 2 contacts as “Required Attendees” to Appointment, for which I used below code and called it 2 times since I need to create 2 activity parties

var activityParty = new Object();

activityParty.PartyId = {

Id: participentId,

LogicalName: participentLogicalName

};

activityParty.ActivityId = {

Id: activityId,

LogicalName: “appointment”

};

activityParty.ParticipationTypeMask = { Value: 5 }; //5 = Required Attendees

var activityParty = createRecord (activityParty, “ActivityPartySet”);

Issue I faced :-

  • The problem I faced was,
    • only one “Contact” added as “Required Attendees” (i.e., Only 1 Activity Party is creating) instead of 2
    • When I debug the script and DB, I observed that 1st activity party is getting created initially but once after the 2nd activity party created, the first one is getting deleted

Reason & Workaround :-

  • Later I came to know that, this is the limitation of OData end point.
  • As a workaround, I registered a Plugin on post create of “Appointment” and added “Activity Parties”

🙂