I had found two ways, kind of similar, which will does the things.
For CRM Lookup field, when accessing from Plugin, is a Entity Reference so need to create an object of that with guid and update the entity with that object will does the trick.
Example:1:
Entity entity = new Entity();
entity = service.Retrieve("new_entityname", new Guid(guid), new ColumnSet(true));
entity["new_fieldName"] = new EntityReference("new_status", statusId);
service.Update(entity);
Example:2:
Entity entity = new Entity("new_entityname",guid);
entity["new_fieldName"] = new EntityReference("new_status", statusId);
service.Update(entity);
Where,
guid = guid of the Entity
new_fieldName = schema name of field
new_entityname = schema name of Entity
new_status = schema name of lookup field
statusId = guid of the lookup field record
Questions/comments/suggestions? please put it in comments below post for further discussion!!!
No comments:
Post a Comment