When setting up a Workflow, you will first need to set up a trigger event to determine when the Action will run. For a list of Trigger Events see our article here: Workflow Trigger Events.
There are a variety of scenarios where you will benefit from automating the linking of Child and Parent Records via workflow. We offer four different methods to help you to keep appropriate Record hierarchies - Actions as described below are added at the bottom of the 'Workflow' section by clicking 'Add Action'.
Link Child Records
This action will look for all Child records that match a given filter criteria and link these Records to the Parent Record that the Workflow was triggered from.
To demonstrate this workflow we will look at an example of linking Contacts to a Supplier when a new Supplier Record is created. In this scenario, a number of Contacts have already been created and then a Parent Supplier App has been added that associates these Contacts to a Supplier.
First select 'Update Record' as the Action and 'Link Records' as the Result.
Next select the Child App that you would like the Parent Record to find it's Child Records from (the 'Target App'). For our example we are adding the Workflow to the Supplier App and are Targeting the Contacts Child App to find Child Contact Records to Link. Next you will need to add the filter criteria that decides which Child Records are going to Link to the Parent:
You can add multiple Field value criteria by using and / or in a Filter String, in which case all defined criteria must be met in order for the Workflow to trigger. For this case when referencing both Parent and Child Apps the structure of a Filter String is slightly different, in this example it would be:
$filter=[Supplier] eq {{Supplier}}
Where [FieldID] is the Parent Field and {{FieldID}} is the Child App Field
Note: A more user friendly way of setting Filters is coming soon, for now entering Filters via string format is supported - See the bottom of here for information on string Filters.
There should be at least one Filter criteria that can be used as a match of values so the Parent Record knows which Children to Link.
Note: If no Target App Filter has been set then the workflow will link all child records.
Now that we have set this up, when a User adds a Supplier Record, it will look for all (Child) Contact Records where the Supplier Name matches the (Parent) Supplier one and link those to the new Supplier.
An additional option is to Ignore Access Rights. By selecting this it will mean that the User triggering the Event on the Supplier Record will not need access to the Contact Record in order for the Link to occur. If it is not selected then a Child Record will only link to a Parent Record if the User triggering the Workflow has Full Access to the Child Record.
Copy and Link Child Records
This Workflow Action is similar to the Link Child Records Workflow but will make a Copy of the Child record to link to the Parent instead of Linking the original Record it finds in the Link filter.
A common use for this Workflow is to Copy and Link a set of master Child Question Records to a Parent Assessment on creation of the Assessment.
First select 'Update Record' as the Action and 'Copy & Link Records' as the Result.
Next select the Child App that you would like the Parent Record to copy and link Child Records from. We are adding the Workflow to the Assessment App and our Target App is the Question App to copy and link Child Question Records.
Then you will need to add the filter criteria that decides which Child Records are going to be copied and Linked to the Parent.
You can add multiple Field value criteria by using and / or in a Filter String, in which case all defined criteria must be met in order for the Workflow to trigger. For this case when referencing both Parent and Child Apps the structure of a Filter String is slightly different, in this example it would be:
$filter=({{IsMaster}} eq true and [Area] eq {{Area}})
Where [FieldID] is the Parent Field and {{FieldID}} is a Child App Field
Note: A more user friendly way of setting Filters is coming soon, for now entering Filters via string format is supported - See the bottom of here for information on string Filters.
There should be at least one Filter criteria that can be used as a match of values so the Parent Record knows which Children to Link.
In our example we are only copying from a master set of Child Questions so our first filter criteria would be to narrow down the selection by this. We have stated that the Field 'Is Master?' in the Question App needs to be true. We can also filter down further by saying that a Field in the Child App needs to match a value from the Parent App. Our example says that the Assessment Area on the Child Question Record needs to match the Area stated on the Parent Assessment record.
Note: When copying and linking records from a master list of records it is important to not let the copied records join the master set. We can make use of a Template Copy which can exclude certain Field values from the Record copy to keep the master list clean. Here we would set a property on the Field 'Is Master?' to be 'Exclude(d) from templated record copy' and it will not copy the value of true but set it to false on copy of the Question.
Note: If no Target App Filter has been set then the workflow will copy and link all child records.
Now that we have set this up, when a User adds a new Assessment record, it will look for all the Master Questions in the Assessment Area chosen and copy and link that set of Child Questions to the Parent Assessment.
An additional option is to Ignore Access Rights. By selecting this it will mean that the User triggering the Event on the Assessment will not need access to the Question Records in order for the Link to occur. If it is not selected then a Child Record will only link to a Parent Record if the User triggering the Workflow has Full Access to the Child Records.
There are some further options that can determine the type of Record copy that is performed.
Templated Copy?: For each Field in an App you can set a property on the Field to 'Exclude This Field From Templated Record Copies'. If this property has been set for certain Fields and you choose to use a Templated Copy, it will not copy the values from these Fields when it copies the Record.
Copy Notes / Comments / Attachments / History?: These options provide you with a more granular choice of the Record copy that you would like. Notes will copy values from Notes Fields. Attachments and Comments will copy any that have been added to these areas of the Record. History will copy the Audit Trail for the Record, by not selecting this it will start the Audit Trail from the point the Record is Copied.
You can also choose to bring back a set number of Child records at Random from those that meet the Target App Filter criteria. To do this select 'Is Random?' and then choose the number of Child Records that you would like to be copied and linked.
Remember to click the 'Update/Add Action' button to save your workflow action, then to save the overall Workflow you must click the 'Update Workflow' Button.
Link To Parent Record
This is a feature that can be used when creating or updating Child records outside of the context of the Parent Record. Our example here will be creating a new Child Invoice and linking it to a Parent Client Record.
Create a new Workflow action and set 'Update Record' as the Action and 'Link To Parent Record' as the Result.
Note: The Link To Parent Record option will only appear if you are adding the Workflow in a Child App.
Next select the App that you would like the Child Records to find a Parent to link to. In our example we are adding the Workflow to the Invoice App and are Target App to find a Parent to Link to is the Client App.
Then you will need to add the filter criteria that decides which Parent the Child is going to link to. Specify this in the 'Target App Filter' box using the same method as detailed above. Here it would be as follows:
$filter=([ClientID] eq {{ClientID}})
Where [FieldID] is the Parent Field and {{FieldID}} is a Child App Field
Note: A more user friendly way of setting Filters is coming soon, for now entering Filters via string format is supported - See the bottom of here for information on string Filters.
There should be one Filter criteria that can be used as a match of values so the Child record knows which Parent to link to. In this case it's an alignment of the 'ClientID' Field in both the Parent and Child Apps, the logic checks to see of these are both equal to one another, if not then nothing will happen, the Child Record will remain stand-alone. However, if the two Field values are found to be equal the correct Parent is identified and the Child Record linked to it. You can add additional filter criteria if you need to. Once you have completed this click 'Ok' and it will add your filter.
What this now means is that a User can create an Invoice and enter the Client ID that it relates to. The workflow will then find the Parent Client record that has that Client ID and link the Invoice to it.
An additional option is to Ignore Access Rights. By selecting this it will mean that the User triggering the Event on the Invoice will not need access to the Client record in order for the Link to occur. If it is not selected then a Child Record will only link to a Parent Record if the User triggering the Workflow has Full Access to the Parent Record.
If we want this workflow to also run every time the Client ID is updated in case it changes on the Invoice, then we could add this workflow again with a Field Updated trigger as opposed to Record Created.
Note: If more than one Parent Record matches the filter criteria then the Child Record will link to the first Parent Record that it finds. A Child Record can only have one Parent Record
Inheriting Security: Copy and Link is a Copy then a Link
So for Record Copy
- Access rights are copied when the Record is copied
For Link
- Access rights are inherited from the Parent it Links to
So both the parent's security and the security of the master record will be on a copied and linked record.
Comments
0 comments
Article is closed for comments.