### Mathematical Operation Example Source: https://help.planhat.com/en/articles/9587026-how-to-build-formula-fields An example of a static formula demonstrating a mathematical operation. Ensure data types are compatible for calculations. ```pseudo-code // Mathematical operation `((5 + 1) / 20) * 30 ``` -------------------------------- ### String Concatenation Example Source: https://help.planhat.com/en/articles/9587026-how-to-build-formula-fields An example of a static formula used for string concatenation. This combines text strings. ```pseudo-code // String `great + company` ``` -------------------------------- ### Dynamic Message Generation Example Source: https://help.planhat.com/en/articles/11144131-replacement-codes-dynamic-references-in-automations This example demonstrates how replacement codes enable dynamic message generation, adapting content based on different Automation runs. The exact data referenced by these codes will vary. ```text "Betty, Tanisha Foreman from Apple has given an NPS rating of 5" ``` ```text "Ravi, Lesley Fisher from GSK has given an NPS rating of 10" ``` -------------------------------- ### Example Replacement Codes in Templated Automations Source: https://help.planhat.com/en/articles/11144131-replacement-codes-dynamic-references-in-automations These examples show how replacement codes are used within messages in Templated Automations. Ensure precise spelling, capitalization, and spacing within the codes. ```text <> ``` ```text <> ``` ```text <> ``` -------------------------------- ### Example Calculated Metric Structures Source: https://help.planhat.com/en/articles/9590739-calculated-metrics-technical-introduction These examples illustrate the JSON structure for different types of calculated metrics in Planhat, including metricOverTime, propertyValue, and complex arithmetic operations. ```json {"type": "metricOverTime", "days": 7, "op": "SUM", "prop": "activities.login"} ``` ```json {"type": "propertyValue", "prop": "company.custom.expected number of logins"} ``` ```json ["MULTIPLICATION",{"type": "rawNumber", "value": 100}, ["DIVISION",{"type": "metricOverTime", "days": 1, "op": "LAST", "prop": "metrics.active_seats"},{"type": "metricOverTime", "days": 1, "op": "LAST", "prop": "metrics.max_seats"}]] ``` -------------------------------- ### Constructing a URL Formula Field Source: https://help.planhat.com/en/articles/11539891-url-formula-fields Examples of URL formula structures using Planhat field references. ```text https://planhat61-dev-ed.develop.lightning.force.com/lightning/r/Account/<>/view ``` ```text https://yourcompanyname.my.salesforce.com/<> ``` -------------------------------- ### Build Formula Field Incrementally Source: https://help.planhat.com/en/articles/9586953-troubleshooting-formula-fields When troubleshooting a complex formula, start with a simple version and gradually add components. Test at each step to identify where the formula breaks. This example shows a progressive build-up of a FIND function with filters. ```formula FIND(License.custom.Owner & { "filters": [ { "op": "more than", "field": {"id": "value": 10}, { "op": "less than", "field": {"id": "Value"}, "value": 100 } } ], "sort": {"lastName": -1}, "limit" : 2 }) ``` ```formula FIND(License.custom.Owner) ``` ```formula FIND(License.custom.Owner & {"filters": [{ "op": "more than", "field": {"id": "value"}, "value": 10 }] }) ``` ```formula FIND(License.custom.Owner & { "filters": [ { "op": "more than", "field": {"id": "value"}, "value": 10 }, { "op": "less than", "field": {"id": "Value"}, "value": 100 } ], "sort": {"lastName": -1}, "limit" : 2 }) ``` ```formula {"op": "less than", "field": {"id": "Value"}, "value": 100 }] ``` -------------------------------- ### Example JavaScript Function for Execute Step Source: https://help.planhat.com/en/articles/11170360-execute-function-steps-in-automations This is an example JavaScript function that can be used within an 'Execute Function' step. You can replace the example code with your own logic. Ensure your function provides a suitable output for subsequent steps. ```javascript function( step1, object ) { // Your code here return object; } ``` -------------------------------- ### Find earliest license start date Source: https://help.planhat.com/en/articles/9586965-formula-field-examples Retrieves the earliest start date from license records. ```text FIND(License.fromDate & { "filters": [{ "op": "has value", "field": {"id": "fromDate"}}], "sort": {"fromDate": 1}, "limit": 1}) ``` -------------------------------- ### Task Creation Field Mappings Source: https://help.planhat.com/en/articles/11100354-custom-automations-worked-examples Configure task details like Company ID, Owner, Action, Type, and Start Date. Use replacement codes for dynamic values. Ensure fields expecting text input are switched from their default picker type. ```text <> ``` ```text <> ``` ```text <> ``` ```text <> ``` -------------------------------- ### Incorrect Replacement Code Example Source: https://help.planhat.com/en/articles/9587341-automation-logs-and-troubleshooting This example demonstrates an incorrect replacement code, `<>`, which can lead to errors during automation execution. ```text <> ``` -------------------------------- ### Example of a Successful Automation Step Log Source: https://help.planhat.com/en/articles/9587341-automation-logs-and-troubleshooting Successful automation steps are displayed in green. This indicates that the step executed without errors. ```text 2023-10-20 10:00:05 - Step 1 - Success ```