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
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.