If you read my previous post, you know how you can use TCSTools Lookup Setter custom worfklow activity to find a lookup value using a fetchxml query:
Let’s imagine a different scenario. What if you had an account and related contacts, and what if you wanted to push a field value you just entered on your account record to all of those contacts?
That is also easy to do, you just need to read that post above, and, then, think of it in reverse.
Here is what you would need to do:
- User Advanced Find to create FetchXml that will return all contacts related to a particular account (pick any account when doing it)
- Download FetchXml from the Advanced Find
- Replace the id of that account in the parentcustomerid condition with “#accountid#”
- Create a Lookup Configuration record (it’s the entity which comes with TCS Tools), and make sure to use “Fetch Result” for the direction. That will instruct the custom workflow activity that it actually need to update the records returned from the fetch (and not the record for which that worfklow has started)
- Create a workflow for the account entity, and use Lookup Setter (paired with the Lookup Configuration created above) to update all those related contacts
Below are a few screenshots.
Here is my lookup configuration record:
- Update direction = Fetch Result (meaning that fetch result records will be updated)
- Fetch Result Attribute is set to “tcs_accountnumber” (this is the field that’ll be updated)
- Entity Attribute is set to “accountnumber” (this is the field on the account record that will be used to update fetch result records)
- Finally, FetchXml is constructed is such a way that it will get all the contacts where my current account record is added as a parent customer
Here is the workflow that will update related contacts – we are only interested in the highlighted step right now. Two other steps are interesting as well, but I will explain what they do in the next posts.
And, of course, just so you could see how that step is configured, here is the last screenshot:
That’s it, really. What this workflow will do, it will push account number updates from the account record to the related contact records (where I have a custom field called “tcs_accountnumber”).
By the way, did you notice something? You don’t really need to define a relationship between two entities to use this custom workflow activity. As long as you can define your fetchxml in such a way that it will return required records (maybe based on the email address.. based on the city name.. or simply based on the date interval), you can use this custom workflow activity to update all those records.
Just keep in mind that you probably don’t want to update thousands of records every time – performance can easily become an issue for this kind of mass updates.