It is not an elegant solution, but it works.
The attribute or field that was created needed to have a relationship tied to the account. So, I created a many to 1 (N:1) attribute to hold the global parent field. I made this field a business recommended, as it would be on all forms. The workflow, that I will explain later, can be set to fire on an account create action to tie the created account to the global parent account.
Here are the settings of the attributes.
Since there was already a parental relationship set with the account entity, a referential enforced relationship would have to be created. In this instance, this will be fine, as we do not want a tied record to be altered if the global parent account gets assigned, or altered. Only a cleanup process would need to happen (to re-assign the global parent), which would be from the workflow below.
Workflow
Here is a snapshot of the published workflow.
The first stage will check if the current account record has a parent account assigned, as it is assumed that when an account is created, they will be assigned a parent account if it is a sub account. If it does the workflow will progress, if not it will end. If there is then it will populate the global parent account field, with the associated parent account, as a baseline. We know that this is at least a possible global account for this account.
From there, it grabs the parent account value for the related global parent account and then applies that value, but only if that global account's "parent account" value is populated. If not then it ends.
Condition check:
Assignment of a value:
Note the Dynamic Value section. The fact that the Global Account field had a data relationship, allows the workflow to access related fields from that global account field, including it's parent account. From there we assign it, and the value is set up the chain.
The step is repeated in the workflow, to make sure that it grabs any deeper hierarchy's with the correct value.
I created an advanced find that grabbed all of the accounts that do not have a global parent account set. I then ran the workflow on demand the set the global parent.
Comments
Post a Comment