Mark Complete an Activity on create through Plugin in CRM 2011

Posted on Updated on

Hi, We had a requirement to immediately close the Appointment record as completed after creating it. The initial thought was to call Set State Request on the Post Create plugin. That approach gave error. Then we tried passing statecodeand statuscode value as input parameter in Pre Plugin. That approach also didn’t work. Finally we registered a pre update plugin on appointment entity and set the values for statecode and statuscodeattributes. This worked for us. The learning is that on create of Appointment record, update message is also called. Sample Code (Pre Update)

Hope it helps.

Cheers

Advertisements