Problem :
“How to parse value from JSON Script and and pass variable values to next step??”
Solution:
Suppose below is response body after successful API call:
{“message”:“OK”,“success”:true,“userFirstName”:“xxxx”,“userLastName”:“xxxx”,“emailId”:null,“errorMessage”:null,“tenant”:{“id”:xxxx,“name”:“AE Demo Tenant 1”,“orgCode”:“DEMO1”,“createdDate”:1523236296088,“lastUpdatedDate”:1580807594573,“onPrem”:null,“trial”:null,“adminOrg”:false,“deleted”:null,“description”:null}," sessionToken “:“19006af5878e60969131c2c7f911ad06addfc56e12c89e5cf7edbd7b74ab4b2f:5ee4ff96-04ef-444b-9e77-72d68930853d1593160313026”,“roles”:“ROLE_TENANT_ADMIN”,“forceChangePassword”:false,“userName”:”*",“lastLoginTime”:1593159164329}
`
If we requires the ‘session token’ to pass for further processing, Just parse this script using JSON Input Step and get required variable as below;
-
Provide JSON Script body in the Select field:
-
Check Do not raise an error if no files checkbox
-
Insert variable for further usage.
As the sessionToken is not under any other field we get its value direct as “$.sessionToken”
Suppose we require “orgCode” under “tenant” field, provide value as “$.tenant.orgCode” -
If you want to pass this variable to pass in next workflow/process. Use set variable Step.
Enjoy the automation with ☞ AutomationEdge!!