
Flow is the most powerful and popular automation tool of Salesforce. There are endless cases that you can solve using Salesforce Flow. Depending on your use case, first you should select the correct flow type. After completing the flow, the next task is to decide how to run it. Although most flow types launch automatically, there are two core flow types that do not have any trigger: Screen Flow and Autolaunched Flow. Screen Flow is the only flow type that supports the screen element and doesn't run in the background. There are various ways to launch a Screen Flow. For instance, Lightning pages, Experience Cloud sites, quick actions, etc. Autolaunched Flow is the only flow type that cannot launch by itself or by user interaction. It launches when it is invoked by Process Builder, another flow (as a subflow), Apex, and more. One of the ways to launch an autolaunched flow is using the REST API.

Launch an Autolaunched Flow from the REST API
REST API can be used to launch autolaunched flows. Although you can perform most of the actions using REST API, in some cases it is a better practice to use an existing flow. On the other hand, this approach makes it easier to maintain the business process. If you need a change in the process, an admin can easily edit the flow to meet the requirements. Therefore you won't need to change the code.
Let's assume that there is an existing autolaunched flow that clones a case with its related records. Then, it sends a custom notification to the old case owner. Let's see how to launch it using the REST API.
You can find a similar flow in this post.
Launch a Flow to Clone a Case Record
1- First, create an autolaunched flow and build the flow according to your needs. In this example, it is an autolaunched flow called Clone_Case_Record.
2- If you want to pass parameters when launching the flow, create variables and mark them as available for input.

This flow has 4 different input variables. CaseId is the main variable of the flow. Flow clones the case record with the id that is stored in CaseId text variable. Moreover, flow lets you decide whether to clone related Case Team Members, Case Contact Roles, or Files. Therefore, there are 3 boolean input variables called CloneCaseTeam, CloneContactRoles, and CloneFiles. If you pass "true" to these input variables, flow clones the related records as well.
3- If you want to store the output of the flow, create variables and mark them as available for output. For example, this flow has multiple output variables to return the new case's id, case number, and the new child record collections.

Here is the assignment element for the output variables of the flow.

4- Let's launch this flow using Postman. After configuring the Postman collection for authentication, create a new POST request. Then, use the Custom Invocable Actions endpoint to invoke an autolaunched flow from the REST API. Here is how it should look like. Pay attention that Clone_Case_Record is the name of the flow.
https://sftimeflow-dev-ed.my.salesforce.com/services/data/v53.0/actions/custom/flow/Clone_Case_Record
Then, use this body format in order to pass values to the input variables of the flow.
{
"inputs" : [ {
"InputVariable1" : "input1",
"InputVariable2": "input2"
} ]
}
Here is how it should look like. As you can see, you are telling the flow to clone that specific case record (according to the id) with case team, contact roles, and files.

Let's Launch the Flow
Click the Send button in order to launch the flow with the input parameters you provided. As you can see, it returned the id and the case number of the new case record. Moreover, you can see the new case record collections as well.

Let's run it again but this time without cloning the child records.

Here you can see that the case record has been cloned twice. Moreover, the user received a notification.

First case is with the related records:

Second one is without the related records:

Hi,
I was reviewing the response I received and noticed that it is different from the one you have shown in the snapshot. I am wondering if you have any suggestions on how I can obtain the complete response as shown in the snapshot.
[
{
"actionName": "Clone_Case_Record",
"errors": null,
"isSuccess": true,
"outputValues": {
"Flow__InterviewStatus": "Finished"
}
}
]
Based on your expertise and experience, I would appreciate any insights or guidance that you could provide on this matter.
Hi,
Did you mark the variables available as output?
When I marked the variables available as output, I'm getting this output in postman
{
"actionName": "Clone_Case_Record",
"errors": null,
"isSuccess": true,
"outputValues": {
"CloneCaseTeam": true,
"CaseId": "5005i000009TQe0AAG",
"CloneContactRole": true,
"CloneFiles": true,
"Flow__InterviewStatus": "Finished"
}
}
]
I understand the issue. You have to create output variables and use an assignment element to assign the results to those variables. See the last screenshot of step 3.
Thank you for your assistance, as it has enabled me to successfully obtain the complete output. Your contributions are greatly appreciated.
You are welcome, I am glad that it worked!
Thanks Yumi! Great article... I think this is a less known territory of Salesforce capabilities, thanks for sharing.
Thank you Danny!