This function can update any of the fields in the Work Order table.
As of r338, Functions is in Production Early Access. To request access, contact your Customer Success manager.
Read more in the Community thread here.
Introduction
Functions allow your team to build shared or standardized logic once and then reuse it in multiple apps. In this example, we are showcasing a function that can update any field in the Work Order table.
Function Flow
As shown below:
Walkthrough
Functions are triggered by a trigger in an application. In the function, you can define inputs that need to be provided by the trigger that calls the function.
In this function, we require 13 inputs, which correspond to the fields in the Work Order table.
These input variables are provided to the function call by the trigger.
In the trigger, each input option is matched with a corresponding variable. If you only want to update a few fields, you can match the inputs for the other fields with an empty static value.
The function uses these inputs to execute.
First, the function is called by a trigger. After being called, the function loads the relevant Work Order record based on the provided input ID.
Next, the function checks the first input variable, which in this case is the Operator. It checks whether the input is empty or the same as the value currently stored in the record. If the answer is “no” for both, it updates the table record with the provided Operator input. If the answer is “yes” for either, it skips updating the Operator field and proceeds to the next action in the function.
The actions described above will also be performed for the remaining 11 inputs.
Function Modification
In the function, you can modify almost everything to fit your process. This specific function uses the Work Order table, but if you would like to use a different table, you can do so by modifying the relevant actions to reference your table instead of the Work Order table.
Further Reading
If you would like to get to know more functions, check out these other documents to extend your knowledge