Answered by:
CRM plugin lead

Question
-
Hi,
I want to create a plugin that updates the account or contact that is qualified from a lead.
It should also create a new task when qualify the lead.I never created a plugin before, so i have a few questions:
1.What type of message do i need to use? (create? update? qualifylead?
2.What should i select in Pipeline Stage? (Pre-Operation, Pre validation, ... ? )Thanks !
Thursday, October 23, 2014 1:30 PM
Answers
-
Hi,
What is it you want to update? Could this be handled with a workflow instead of a plugin?
To answer your two questions, it's probably a create message and for question two, if possible put it in the pre-operation stage. This depends a lot on what you want to do.
Regards
Rickard Norström Developer CRM-Konsulterna
http://www.crmkonsulterna.se
Swedish Dynamics CRM Forum: http://www.crmforum.se
My Blog: http://rickardnorstrom.blogspot.se- Proposed as answer by Rob BoyersEditor Monday, October 27, 2014 10:18 PM
- Marked as answer by Alexander_DM Tuesday, October 28, 2014 8:54 AM
Friday, October 24, 2014 9:13 AM
All replies
-
Hi,
What is it you want to update? Could this be handled with a workflow instead of a plugin?
To answer your two questions, it's probably a create message and for question two, if possible put it in the pre-operation stage. This depends a lot on what you want to do.
Regards
Rickard Norström Developer CRM-Konsulterna
http://www.crmkonsulterna.se
Swedish Dynamics CRM Forum: http://www.crmforum.se
My Blog: http://rickardnorstrom.blogspot.se- Proposed as answer by Rob BoyersEditor Monday, October 27, 2014 10:18 PM
- Marked as answer by Alexander_DM Tuesday, October 28, 2014 8:54 AM
Friday, October 24, 2014 9:13 AM -
I agree with Rickard here, workflow would be more flexible for the administrator and easier for you to build.
You would create 2 workflows, one on contact and one on account, both trigger oncreate with the following check condition at the beginning;
IF originating lead contains data
CREATE Task
...etc
Rob
MCTS. GAP Consulting Ltd. Microsoft Community Contributor Award 2011 & 2013
- Proposed as answer by Rob BoyersEditor Monday, October 27, 2014 10:18 PM
Monday, October 27, 2014 10:18 PMAnswerer -
Hi, thanks for the reply's!
I created this in a workflow, but i was just curious how to create this with a plug-in.
The reason is I want to learn create/ deploy plugins. I thought this case could be a good exercise.Thank you.
Tuesday, October 28, 2014 8:54 AM -
Hi,
It might very well be a good starting point to learn how to code plugins, however there's a bit light on information to give you any good pointers.
In general you want to register plugins in pre-state, this is true if you are modifying data on the calling entity. The reason why you want those plugins in the pre-state is that you manipulate data before the database operation and thus saves one database operation (which is A LOT of database calls btw).
For plugins that manipulate other entities you probably want to use "complete" data and those would probably be registered in the post state and use a post state image to retrieve all the fields you want to use on the record. When you call a plugin the only fields you get on the incoming message are the changed fields, you can of course get all fields using a pre state image too, but that would not give you the data present after db-operation where you could have other plugins doing business logic for you.
You could also argue if it's better with a workflow or not depending on when you need the data considering that workflows are asynchronous processes and will be executed when there's time to do so while a plugin can be set to run synchronous or asynchronous depending n what you want to do.
That you get an answer like mine and Rob's is that it might be a better architectural solution to have a workflow sometimes plus it cuts down on development and test time.
Hope it helps.
Rickard Norström Developer CRM-Konsulterna
http://www.crmkonsulterna.se
Swedish Dynamics CRM Forum: http://www.crmforum.se
My Blog: http://rickardnorstrom.blogspot.seTuesday, October 28, 2014 9:07 AM