Custom Controls in Dynamics 365 Business Process flows

Today I was just searching some stuffs on Custom Controls and then stumbled upon this link – https://docs.microsoft.com/en-us/business-applications-release-notes/October18/microsoft-flow/custom-controls-in-business-process-flows

Although the documentation tell that it is possible to embed custom controls in Business Process flow, it does not tell explicitly on how it can be done.

And finally after much searching I found it in Microsoft Flow Community blog – https://powerusers.microsoft.com/t5/Microsoft-Flow-Community-Blog

I could find some really wonderful posts there and I would sincerely suggest you to read this.

Now coming back to this article. I have been asked about how to put custom controls in Business Process flows for sometime by Customers but all this time I said “No it can’t be done”. But now we can do that. So without wasting more time let’s do it.

Let’s take the simplest business process flow here which comes OOB  – “Lead to Opportunity Sales process”.

image

As you can  see from the above screenshot, there is field called – “Estimated Budget” which is of type currency in the first stage of the business process flow which is Qualify. Normally this would render as a textbox in your business process flow. How about rendering it as more visually appealing control.

But wait you need to do bit of XML manipulation here. So let’s follow the steps.

  • Create a Solution
  • In the solution add the Lead Entity using “Add Existing” feature and add only the Lead form for the entity.
  • We all know that corresponding to each Business Process flow, an entity is created in CRM. Add the entity corresponding to our Lead to Opportunity sales process flow. The entity name will be same as the Business Process flow name.

You should should look like this.

image

Now I open the lead form in form editor. If you observe carefully, I have couple of field in the Qualify stage of business process flow that I will play with. One is the “Estimated Budget” which I mentioned earlier and the other is “Purchase Timeframe”

I put both the fields on the form.

image

I go to the field properties and change the control for Budget amount to Radial Knob and for Purchase timeframe to Optionset.

image

image

I save and publish the form. Now when I open the lead form, I could see the new controls on the form but the business process flow still shows the old controls.

image   image

So changing at the form level is not making the change at Business process level.

So let’s accomplish this. Export your solution as Unmanaged and once the solution is successfully exported, unzip your unamanged solution.

image

Three files as you can see. No surprise in this.

Open customizations.xml in an editor of your choice. What we will do hear is make the changes for budgetamount field in BPF but keep purchase timeframe untouched.

In the lead form xml of the lead entity search for “budgetamount” field.

image

The important thing here is the uniqueid highlighted in yellow. Make a note of that.

Now with the same uniqueid, search in your customization.xml file. You will find the custom control description for this budget amount field. Copy the controlDescription for this field. In my case it is as below

<controlDescription forControl="{0487895c-be18-985a-c3d4-1540e3d2ed86}">
                   <customControl id="{533B9E00-756B-4312-95A0-DC888637AC78}">
                    <parameters>
                      <datafieldname>budgetamount</datafieldname>
                    </parameters>
                  </customControl>
                   <customControl formFactor="0" name="MscrmControls.Knob.RadialKnobControl">
                    <parameters>
                       <value>budgetamount</value>
                      <min static="true" type="Whole.None">1</min>
                      <max static="true" type="Whole.None">100000</max>
                       <step static="true" type="Whole.None">200</step>
                     </parameters>
                  </customControl>
                   <customControl formFactor="1" name="MscrmControls.Knob.RadialKnobControl">
                    <parameters>
                       <value>budgetamount</value>
                      <min static="true" type="Whole.None">1</min>
                      <max static="true" type="Whole.None">100000</max>
                       <step static="true" type="Whole.None">200</step>
                     </parameters>
                  </customControl>
                   <customControl formFactor="2" name="MscrmControls.Knob.RadialKnobControl">
                    <parameters>
                       <value>budgetamount</value>
                       <min static="true" type="Whole.None">1</min>
                       <max static="true" type="Whole.None">100000</max>
                       <step static="true" type="Whole.None">200</step>
                    </parameters>
                  </customControl>
       < /controlDescription>

So we have copied the uniqueid value and the Control description.

Now within the entity of our Business process flow, you would find 4 tabs.

image

These tabs are nothing but stages of the business process flow. If you remember, the Lead to Opportunity sales process flow has four stage and hence four tabs. Also if we remember, our budget amount field was in the first stage – Qualify.

So expand the first tab and locate for the budgetamount field.

image

Put the uniqueid attribute as we copied earlier.

image

Now after the tabs section, place the customControlDescription that you copied earlier for budgetamount field. Please note it should be inside <controlDescriptions> tag.

image

All done. Save your customization.xml and re-zip your files. Import the new zipped file back to your environment. And now you can see the wonderful custom control in your Business Process flow as well.

image

You must be seeing Purchase timeframe is still rendering as regular optionset. The reason is we didn’t do anything for that field. We just modified the Budget amount field. Take it as lab exercise and do it yourself.

Wonderful isn’t it?

Hope this helps!

Debajit Dutta

(Business solutions MVP)

For consultation/ corporate training visit www.xrmforyou.com or reach out to us at info@xrmforyou.com or our training page http://www.xrmforyou.com/training-.html

Our product offerings:

Role based views for Dynamics 365 (http://www.xrmforyou.com/role-based-views.html)

CRM-Sharepoint Attachment uploader and metadata manager (http://www.xrmforyou.com/sharepoint-integrator.html)

Record Cloner for Dynamics 365 (http://www.xrmforyou.com/record-cloner.html)

Multiselect picklist for Dynamics 365 (http://www.xrmforyou.com/multi-select-picklist.html)

Advertisements

One thought on “Custom Controls in Dynamics 365 Business Process flows

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s