How to add values from an api response and store in session so we can use it in flows?

i have an api where i want to use those values in body in flows

can i store those values anywhere like in session variables???

so i can use those values in entire user session where these values used in many flows

need a quick response please

thanks and regards

Hello @priya.sai.manohar ,

When you mention an API, is it in Builder or SmartAssist?

thanks for response
it is in builder
i used this UserSession.put(“EmployeeID”,context.serivelayer.response.body.Employee.EmployeeID)

once they stored in session we can use these in entire session in any where and any flow right??

Hi Priya,

We use script nodes after a service node is called. Example of script node JS is below .
At this point we can use the context variables in the flow. Is this what you mean?

context.isShowAPIFailMsg = false;

if (context.GetEmpDetails && context.GetEmpDetails.response && context.GetEmpDetails.response.body && context.GetEmpDetails.response.body.Report_Entry.length > 0) {
context.employeeType = context.GetEmpDetails.response.body.Report_Entry[0].Employee_Type;
context.empId = context.GetEmpDetails.response.body.Report_Entry[0].Employee_ID;
context.Is_PeopleLeader = context.GetEmpDetails.response.body.Report_Entry[0].isManager;
context.IsEEUnionMember = context.GetEmpDetails.response.body.Report_Entry[0].Is_Union_Member;
} else {
context.isShowAPIFailMsg = true;