Discussions

Ask a Question
Back to all

Lodash connector body configuration with context variables

My Current Problem

I am trying to utilize the Lodash connector to find a specific value in a JSON file. My intended steps:

  1. 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
  2. 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".
  3. 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:

Lodash 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.