Run Real-time Scenarios Guide

This guide shows how to set up the inputs and process outputs for running Overcast Real-time Scenarios from Flow. See Run Real-time Scenarios Action for the input and output parameters details.

Contents

  1. Prerequisites
  2. Run
  3. Query
  4. Insert, Update, Delete
  5. Response Handling

Prerequisites

1. An activated Real-time Integration Scenario with the option Use in Flow enabled. 

 

Below are the instructions on how to create the inputs for running the different types of Scenarios.

Run

Invoke-only Scenarios take input parameters and return response data. They do not take a Query object. SAP BAPIs and Open API web services are invoke-only.

The Scenario Action Parameters class has the Request Data variable. The Request Data variable's type is the Scenario class. You should open the Scenario class to discover the properties' data types because Flow does not display the Apex types.

 

Create a resource for the Scenario's Request Data variable. After this variable has been assigned values, assign it to the Scenario's Request Data variable.

  1. Resource Type: Variable.
  2. Name: Data.
  3. Data Type: Apex-Defined. Allow multiple values (collection) is unchecked.
  4. Apex Class: <scenario name>.
  5. Availability Outside the Flow: both unchecked.

 

Assign the Scenario's input parameters to the Data variable.

 

After all input parameters are assigned, create an Apex Action element for the Scenario and assign Data to the Request Data variable.

 

Query

Create an Apex Action element for Create an Overcast Real-time Query Object.

 

The parameters you can configure are

 

Condition values can be assigned with literal values or Flow variables. If flow variables need to be assigned to limit or offset, use an Assignment element to update the query object.

 

After all input parameters are assigned, create an Apex Action element for the Scenario and assign output value to the Query Object variable. If there is an Operation variable, assign the text Query.

Insert, Update, Delete

The Scenario Action Parameters class has the Request Data variable. The Request Data variable's type is the Scenario class. You should open the Scenario class to discover the properties' data types because Flow does not display the Apex types.

 

Create a resource for the Scenario's Request Data variable. After this variable has been assigned values, assign it to the Scenario's Request Data variable.

  1. Resource Type: Variable.
  2. Name: Data.
  3. Data Type: Apex-Defined. Allow multiple values (collection) is unchecked.
  4. Apex Class: <scenario name>.
  5. Availability Outside the Flow: both unchecked.

Add an Apex Action element for the Scenario and assign the operation text to the Operation variable, i.e., Insert, Update, or Delete.

 

Assign the Scenario's input parameters to the Data variable. For inserts, the Data variable should be assigned all the records or data to insert.

For updates and deletes, the records must contain the primary key values, so it is recommended to first query for the exact records to update or delete so the data is confirmed to be valid. The response body from the query can be used as the input for the update or delete operation. 

 

Response Handling

See Run Real-time Scenarios Action for details on the output values.

The Scenario response object data type is the Scenario's Apex class. Create a resource to store the response data from the result.

  1. Resource Type: Variable.
  2. Name: ResponseData.
  3. Data Type: Apex-Defined. 
  4. Allow multiple values (collection) is checked if the Scenario class property is a List. The following steps are assuming a List/collection.
  5. Apex Class: The Apex class of the Scenario class property.
  6. Availability Outside the Flow: both unchecked.

 

Add an Assignment element and assign the response data to ResponseData.

  1. Variable: {!ResponseData}
  2. Operator: Equals
  3. Value: {!<scenario action>.response.<propertyName>}

Add a Loop element and specify {!ResponseData}.

Create a resource to hold a single record of the target record type. 

Add an Assignment element and assign the loop element values to the single record variable.

Create a resource to hold a collection of records of the target record type.

Add an Assignment element and assign the single record to the collection.

Add a Create Records element to insert the collection into the database.

Connect all the elements in the aforementioned order like the image below, then save and debug the flow.

 

This completes the guide for running Overcast Real-time Scenarios.