2015-2-13 | apurvghai | Dynamics CRM SDK | C#
Today I'm going to talk about an exciting new feature of CRM 2013/2015 environment "Business Process Flows". You can read more about the features here
While you can do this job from UI, but the idea is to automate the creation of next steps automatically. This article talks about the a plugin code using CRM SDK to achieve this.
Some Prerequisites before you start:
- Hands on CRM 2013 - Business process flow
- Hands on CRM SDK 2013
- Plugin Registration for CRM 2013
- .NET Framework 4.0 / Visual Studio 2012 or higher
Consider the scenario below:
- Opportunity Entity
- Custom Entity new_customflow
Please make sure you've enabled "Business Process Flows" in the entity customization for "new_customflow" entity, see below image:
- Now go ahead and create a business flow with a custom entity
This will look like as shown below:
You're all set with designing the business Flows via CRM customizations.
- Now when you create opportunity, it should automatically create a record for Custom Flows and link it to existing opportunity.
You'll need to write the code as below
- This code will be registered as Plugin
For Plugins (Config):
a. Message: Create
b. Entity: Opportunity
c. Operation: Post
d. Execution mode: Sync
Note: The workflow Id and Stage Id has to be correctly mentioned. In this sample, I've used hardcoded values which can be replaced by just doing a simple retrieve using SDK. Or you can use Early bound classes to use "WorkflowSet".
You're now all set for automating your business process flows. As you hit "next" you can see the opportunity is now listed as connected flow. In the below screenshot, notice "108".
I'd like to thank Kaustubh Giri who helped me with all the testing and innovating the business processes.
Happy customizing! :)