Answered by:
Plugin with Assign message is not getting fired while creating new record for custom entity.

Question
-
Plugin with Assign message is not getting fired while creating new record for custom entity. The same plugin gets fired when i am trying to update record. I have created Plugin for Assign message with Post and Asynchronous settigs. I am trying to change the ownerid of the record. But it should happen both for create and update. Right not it is happening only for update and not for create.Monday, August 9, 2010 10:36 AM
Answers
-
Yes. This is possible, like when plugin fires in pre mode:
DynamicEntity ent = (DynamicEntity)context.InputParameters["Target"];
ent["ownerid"] = new Owner("systemuser", <identifier of user>);
context.InputParameters["Target"] = ent;
Microsoft CRM Freelancer
My blog (english)
Мой блог (русскоязычный)- Proposed as answer by Andrii ButenkoMVP, Moderator Monday, August 9, 2010 12:35 PM
- Marked as answer by DavidJennawayMVP, Moderator Monday, September 13, 2010 5:11 AM
Monday, August 9, 2010 11:50 AMModerator
All replies
-
Assign message doesn't fire when record is being creating. You should handle create message.
Microsoft CRM Freelancer
My blog (english)
Мой блог (русскоязычный)- Proposed as answer by Andrii ButenkoMVP, Moderator Monday, August 9, 2010 12:35 PM
Monday, August 9, 2010 10:46 AMModerator -
Please check context message
if(context.MessageName !="Create")
Monday, August 9, 2010 11:01 AM -
is it possible to change the ownerid in create message?Monday, August 9, 2010 11:41 AM
-
Yes. This is possible, like when plugin fires in pre mode:
DynamicEntity ent = (DynamicEntity)context.InputParameters["Target"];
ent["ownerid"] = new Owner("systemuser", <identifier of user>);
context.InputParameters["Target"] = ent;
Microsoft CRM Freelancer
My blog (english)
Мой блог (русскоязычный)- Proposed as answer by Andrii ButenkoMVP, Moderator Monday, August 9, 2010 12:35 PM
- Marked as answer by DavidJennawayMVP, Moderator Monday, September 13, 2010 5:11 AM
Monday, August 9, 2010 11:50 AMModerator -
Thanks a lot Andriy , its working.
Monday, August 9, 2010 12:34 PM -
You can use plug in regestration tool available at in sdk
and also can check for samples
Monday, August 9, 2010 6:55 PM