Scenario Overview
In this scenario when a Task is created in the system we need to find the latest note that is associated with the regarding field & place it into the description field on the Task record.
North52 Decision Suite Solution
The North52 Decision Suite solution works like this,
- A formula is created which executes on the create of a Task
- The formula first checks to see if the regarding field has been set
- If so it retrieves the fetch-xml & executes it to get a recordset
- We then retrieve from the first row of the recordset the notetext field
- This field is then placed into the description field of the Task
North52 Decision Suite Steps
- Create a new formula of type 'Save - To Current Record'
- Set the Event to 'Create'
- Set the Source Entity to 'Task'
- Set the Target Property to 'Description'
- Copy & paste the formula below into the formula description field & click save
- Next scroll down to the formula detail grid & add a new record
- Give it the name 'RetrieveLatestNote'
- Copy & paste the fetch-xml below into the query field & click save
- You are now ready to test
Formula
if( ContainsData([task.regardingobjectid]) ,
FindRecordsValue( FindRecordsFetchXml( StringFormat(GetfetchXml('RetrieveLatestNote'),
[task.regardingobjectid]) ),
'notetext',
''),
'NoOp')
Fetch-XML
<fetch version="1.0" output-format="xml-platform" count="1" mapping="logical" distinct="false"> <entity name="annotation"> <attribute name="notetext" /> <order attribute="modifiedon" descending="true" /> <filter type="and"> <condition attribute="objectid" operator="eq" value="{0}" /> </filter> </entity> </fetch>