Recurring Opportunities Workflow Functionality Dynamics CRM 2013

(Ali Hassan Bajwa)

Problem Statement

In Dynamics CRM 2013, when a user creates new opportunity then there should be an option for recurring opportunity. If user want to create recurring opportunities, then he/she will mention number of occurrence value. A workflow will work in background which will divide total amount of User Created Opportunity by No. of Occurrence and that amount will be budget amount of each generated occurrence of opportunity.

Solution

I am going to do this using workflow and business rules. There would be no custom coding to handle this problem. Let’s do it step by step.

If you don’t have Dynamics CRM 2013 then signup for trial account at following link

http://www.microsoft.com/en-us/dynamics/crm-free-trial-overview.aspx

Navigate to Sales

Now from Sales go to Opportunities

Following screen will be shown. Now click on New

Following screen will be shown. Now click on Form

New form dialogue will be opened as shown below.

Now come to our problem solution.

In above screen, Click New Field to create “Is Recurring” field. Set appropriate values and click save and close

Now drag and drop “Is Recurring” custom field from Field Explorer to form. 

Similarly create “Counter" Field (of Whole Number type and set Minimum value to zero), No. of Occurrence (Whole Number type and set minimum value to zero), Recurrence Amount (Currency type) and drag and drop on form.

Now form will look like following:

Make Counter, No. Of occurrence and Recurrence Amount hidden. To do so, Double click on field and uncheck “Visible by default” checkbox.

Now we will apply business rules to show hidden fields on the base of user input. When user will select Yes in Is Recurring field then No. of Occurrence field will be visible. When value set in No. of Occurrence and Budget Amount then automatically Recurrence Amount value will be set on the basis of No. of Occurrence / Budget Amount.

You can apply Business rule in form but I will apply business rules from Microsoft Dynamics CRM è Settings è Customizations è Customize the System. New window will open. In left panel expand Entity è Opportunity and click on Business Rules. Click on New and define business rules.

Reset and hide all relative fields when Is Recurring equal to No. Define condition as in following and click on tick.

Now click on Plus sign under Action and select “Set Visibility”.

Create Business Rules which fulfill following statements:

When Is Recurring field is set to NO then

Hide No. of Recurrence

Hide Recurrence Amount

When Is Recurring field is set to YES then

                Set Counter, No. of Occurrence, Recurrence Amount to zero

                Set No. of Occurrence, Budget Amount as Business Required

                Show No. of Occurrence, Recurrence Amount fields.

When No. of Recurrence and Budget Amount is greater than zero

                Set Recurrence Amount=Budget Amount/No. of Occurrence

After creating these Business Rules, activate them and Publish All Customizations.

Now it’s time to define workflow for Recurring Opportunities.

Go to Microsoft Dynamics CRM è Settings è Processes. Click on New and fill relative information (as in below fig) and Press OK.

As you press Ok button new window will open where you will define steps to perform by workflow. In Starts When, check the Records Field change checkbox and click on Select button to set the field.

New popup will open, check the Counter checkbox. 

Now in previous window, click on Add Step and select Stage.

Give description for Stage and add step of Check Condition. Then click on condition link and define condition for “If Is Recurring equals Yes and Counter is less than No. of Recurrence” as in figure below:

Click save and Close. Then add new step (in body of this condition to) Start Child Workflow. Give description for this step, select opportunity in dropdown and click on Lookup button and click on Lookup More Records.

Following popup will open. Click on New and create child workflow

Now create child workflow with same steps given above but when you create child workflow check the checkbox for As a Child Process. And in steps create record for opportunity. You can also set value from parent workflow in child workflow’s new record.

You can set properties by clicking on Set Properties button.

Now SAVE it and Activate and then add this child workflow in parent where we were going to start child workflow.

We are again in parent workflow window. Add step to Update Record and increment Counter by One by setting this option in Set Properties window as given below:

Parent workflow screen would look like following where last step Stop Workflow is added. Save it and activate and then everything is done.

Now as you will create new Opportunity, with Is Recurring Option Yes and mention no. of occurrences and budget amount. Child opportunities will be created automatically through this workflow in backend.

If you have any query regarding this tutorial please feel free to ask. And also most welcome to give your suggestions.

**DON'T FORGET TO LIKE AND VOTE THIS TUTORIAL **