Discussions
Lodash connector body configuration with context variables
19 days ago by Rob Murray
My Current Problem
I am trying to utilize the Lodash connector to find a specific value in a JSON file. My intended steps:
- Receive a JSON response "listCustomers", which holds an array of objects in the "customers" class. EX: "context.data.listCustomers.customers[0]" is the first object, which represents a specific customer with their details
- I am then trying to use the lodash _.map function to parse the array of customer objects and return a 2D array, where each nested array holds the customer's "phone_number" and "customer_id".
- Once I have the 2D array of customer phonenumber mapped to their customer_id, I intend to use the .filter(or _find) lodash function to parse that array with a known "phone_number" variable so that I can find the correct and corresponding customer_id.
Step 1 currently works, and I am stuck on Step 2, as I do not fully understand how to input the context variables into the body configuration of the lodash args.
My current attempt:
(If the image doesn't load correctly)
"args": ["{{context.data.listCustomers.customers}}", ["phone_number", "id"]]
If someone could help me understand how to properly input the context variables, I would greatly appreciate it.