we can update any entity record without retrieving
String stdattendeeFetchXML = $@"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
<entity name='std_stdattendee' >
<attribute name='std_contactid' />
<attribute name='std_attendeecategory' />
<attribute name='std_attendeeroleid' />
<attribute name='std_name' />
<filter type='and' >
<condition attribute='std_stdid' operator='eq' value='{ClonestdId}' />
<condition attribute='statecode' operator='eq' value='0' />
<condition attribute='std_attendeeroleid' operator='not-null' />
</filter>
</entity>
</fetch>";
var stdattendeeresult = localContext.OrganizationService.RetrieveMultiple(new FetchExpression(stdattendeeFetchXML));
if (stdattendeeresult.Entities.Any())
{
foreach (Entity stdattendee in stdattendeeresult.Entities)
{
localContext.OrganizationService.Update(new Entity(std_stdattendee.EntityLogicalName, stdattendee.Id) { ["std_stdseriesid"] = copystdSeries.ToEntityReference() });
}
}
Comments
Post a Comment