Executing a Function

Updated 4 weeks ago by Copado Solutions

If you have gone through the Functions article, you may already know what a function is and how you can build one. In this article, you will learn how to execute a function.

In this article, you will learn how to execute a function. Copado enables you to execute a function from different places such as a Function record or a Salesforce flow. Let’s dig deeper into each of the options you have to run a function.

Executing a Function from the Function Record

Once you have finished building your function, you can run it straightaway from the Function record and check if everything is working as expected by clicking on Execute Function:

Execute Function Button

Once the function has been executed, Copado will create a Result record with the job status. In this record you can also find the logs attached so that you can further troubleshoot the issue if the job has failed.

Result Record

Executing a Function from a Salesforce Flow

If you want to execute a function as part of your Salesforce flow, you can easily do this by using the Invoke Copado Function method. You will need to provide the API name of the function and the required parameters, if any. This information should be available in the Function record you want to execute:

Invoke Copado Function

Leveraging System Properties

When executing a function, system properties sent as parameters to the function get replaced based on the context. These properties are similar to environment variables, however, they can not only be linked to environments but also to a pipeline, a user or any object record.

For more information about all the system properties available, please check out the article System Properties.

How did we do?