Global variables are the variables which will be available throughout the integration. The variable can be any types as mentioned:
- String
- Boolean
- Date
- DateTime
- Object
- Number
Data Stitch allows us to create assignments to complex types variables.
Where we need this?
Suppose we have a scope or if block from where we need to take some response to the outside of the block or scope, in simple we cant achieve it. In this regards, we need to implement global variable and data stitch concepts.
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