Here is a question somebody asked in the community forums today:
I want to create a workflow that checks if a new lead is from a list of countries ‘List A’ (ie europe), then it will send an email to the team leader for those countries. Then I will have a ‘List B’ (ie usa, canada etc) that will send an email to team leader for countries B. Then List C and List D.
Apparently, it can be done with some development.. but that made me thinking if it’s something I could do with TCS Tools ?
See below how it worked out.
First, I’ll need to emulate the same entity structure, so I’ll need to create a Country entity. Every country will have a name and a lookup to a country manager (which is a user in Dynamics). So, here how it looks like:
And I’ll have a couple of countries to make this a more interesting exercise:
The way I’m planning to make it work is:
- I will add a user lookup field to the Lead entity (will call it “Country Manager”, too)
- I will use TCS Tools to populate that field whenever lead’s “Country” field is updated
- And, finally, I’ll have a workflow that will be sending an email whenever that field on the lead is updated
Here is my new “Country Manager” field on the lead form – actually, I don’t need it to be on the form, but, for the time being, it will help with testing:
Again, that field is just a lookup to the user entity:
How do I populate that lookup without developing some custom code, though?
What I need is a FetchXml which will give me the country record based on the country name. So, let’s use Advanced Find to create the query:
I made sure I have added “countrymanager” attribute to the columns, and, then downloaded the fetch:
<fetch version=”1.0″ output-format=”xml-platform” mapping=”logical” distinct=”false”>
<attribute name=”tcs_countryid” />
<attribute name=”tcs_name” />
<attribute name=”tcs_countrymanager” />
<attribute name=”createdon” />
<order attribute=”tcs_name” descending=”false” />
<condition attribute=”tcs_name” operator=”eq” value=”#address1_country#” />
Finally, I need to use TCS Tools with that fetchXml.
1. Let’s create a lookup configuration under TCS Tools:
The last screenshot is where all the logic is, really. Basically, what I’m doing there is creating a lookup configuration that will use tcs_countrymanager attribute from the fetch result to set tcs_countrymanager attribute on the record for which the workflow will be running (I’ll set up the workflow a bit down below). And it will use address1_country attribute of that record for the filter condition.
So.. Saving the record and starting to create a workflow:
Organization scope.. will run on create of the lead record and, also, on update of the “Address1: Country” field.
I need to add TCS Tools –> Attribute Setter step:
Configure the properties of that step:
Then activate the workflow.. And run a test.
Let’s create a lead and enter “Canada” into the “Country” field:
Click “Save” and observe the results (since it’s a real-time workflow that I created above):
As for sending the email – that can be implemented as a separate workflow or as part of the same workflow, but it’s going to be a very routine workflow (sending an email to the user that’s selected into the Country Manager field on the lead record), so, I guess, there is no need to show how to do it here.
This is a really useful scenario, and I can imagine a few different applications for it in my system. Unfortunately, for the time being we’re still on v8.1, I don’t suppose you have a version of TCS Tools that is compatible with that do you?
I’ve added a link to the 8.1 version, but it’s, basically, the same solution exported from 365 using 8.1 as a target.. May or may not work:
Unfortunately it failed with the following error:
“The import of the solution TCSTools failed. The following components are missing in your system and are not included in the solution. Import the managed solutions that contain these components (AppModuleWebResources (2.0)) and then try importing this solution again.”
I assume that’s because it is packaged as an App for D365. I appreciate you trying though!
Well, looks like I’ll need to find a test environment for 2016.. thanks for doing the test, though:)
no worries, I appreciate you taking the time to export it. If you manage to get a version that is backwards compatible I’ll be very keen to try it out!