This recipe will calculate a new attribute field from two (or more) existing attributes. This specific recipe guide will calculate an Expiration Date from a Term(months) and Effective Date.
What you'll need:
Time Required: 20 minutes
Skill Level: Intermediate
- Permission to edit attributes in your Thomson Reuters Document Intelligence Workspace
Create a new Recipe:
- Navigate to Document Intelligence Automate and select 'Create Recipe'
- Name the Recipe, select the Location (it should default to the project that was open), and select 'Trigger from an app'. Then click 'Start Building'
Build a Recipe:
- Select 'Thomson Reuters Document Intelligence - User' as the app for the Trigger step. Select an existing connection, or select Create Connection. Enter in the same credentials that are used to sign into the Thomson Reuters Document Intelligence Platform.
- For the Change Type field, select 'Attribute Created', 'Attribute Field Added', and 'Attribute Field Changed'. For Attribute Values, select the 2 Attributes that are going to be used for the calculation. For this recipe, Term(Months) and Effective Date. This ensures the recipe will only trigger when one of the 2 fields needed for the calculation are changed or added.
- Add a new action and select 'Thomson Reuters Document Intelligence - User' as the app. Choose 'List Attributes' as the action.
- Add the Document ID Data Pill from the Trigger action to the Document ID field. For Attributes, select the 2 attributes needed to calculate (in this case, Term and Effective Date) and the attribute where the calculation will be added(for this example, Expiration Date).
- Add a new action and select 'IF Condition'
- For Data Field, add 'Term' and for the Condition, select 'is present'.
- Select the '+' icon to add another condition and select 'AND'. For the Data Field, enter 'Effective Date' and for the Condition select, 'is present'. This step ensures that all of the necessary fields for the calculation are present. If the necessary fields are not present, the recipe will end.
- Add a new action and select the 'IF Else' action.
- For the condition of Line 4: set Data field to Expiration Date and Condition to 'is not present'. This will check to see if the 'Expiration Date' attribute exists or not. If it does not exist, the recipe will add a new attribute. If it does exist, the recipe will remove the old attribute and add a new one.
- Follow the 'Yes' path and add an action using the 'Thomson Reuters Document Intelligence - User' app and 'Add attributes' as the action.
- For the Document ID field, add the Document ID Data Pill from the Trigger action. For Attributes, select 'Expiration Date' (or whatever attribute you would like to add)
- In the Expiration Date field, toggle the field to use a 'formula'
- In the formula, Term and Effective Date need to be added together. Select the data pill for Effective Date from the output of action #2
- Then add a plus sign (+) and select the Term from the output of action #2. For the formula to work, there are some things that have to be done to the Term value in this case. It needs to be declared as a number and also tell TT Automate that it is measured in months. Add ".to_i.months" after the term Data Pill. It should look similar to the screenshot below:
- Next, below the 'ELSE' block (should be on line 6) add a new action (Line 7). Use 'Thomson Reuters Document Intelligence - User' as the app and select 'Delete Attributes' as the action.
- In the Document ID field, add the Document ID Data Pill from the Trigger action, and in Attributes, select Expiration Date. This will delete any Expiration Date attributes on this document.
- Go to the previous 'Add Attributes' action, right-click, and select 'Copy'
- Hover below the 'Delete attributes' action and select 'Paste'
That's it! Run some tests on your recipe to ensure it delivers the desired results.
NOTE: When this is turned on, it will listen and take action on any documents you have access to. If you need to limit what documents this will take action on, additional rules can be added to the Trigger to be more selective or more conditions added to Line 3 to stop the recipe.
- Update a status or workflow attribute when this is successful
- Send another notification if the expiration date is within a certain number of days/months