Use Case:
Understanding and Using Global Variables and data stitch in Integration
What are Global Variables?
Global variables are accessible throughout the entire integration process. These variables can be of various types, such as:
String
Boolean
Date
DateTime
Object
Number
Additionally, Data Stitch allows us to assign values to complex type variables.
When Do We Need Global Variables?
Consider a scenario where you have a scope or an if block, and you need to pass a response or data outside that block. This cannot be achieved directly due to the limited scope of variables. In such cases, implementing global variables combined with Data Stitch concepts becomes essential to handle the data seamlessly.
Implementation steps:
Here, we will use rest trigger to post file name and file path and read the csv file from remote directory in a scope and map to the rest response.
Step1: Create an app driven integration and drag and drop a rest trigger and provide a name and verb as POST and select the following
Configure a request payload for this endpoint
Configure this endpoint to receive the response
Next
Provide request Json sample:
{
"fileName": "emp.csv",
"filePath": "inbound/poc"
}
Next
Provide response json sample:
{
"empName" : "asd",
"EmpId": "123"
}
Step2: Take a scope for read file
Drag and drop file ftp connection and map the file name and file path.
Step3: Global variable creation:
Now go to (x) variable section and add variable. Provide variable name and select object in this case. Now choose the ftp response part as type.
Step4: Data stitch:
After the read file part, drag and drop data stitch action and choose the global just created and operation as assign and choose value as the response of the ftp read .
Step5: Now after the scope, map the response of the global variable to the response of the rest.
No comments:
Post a Comment