Discussions

 View Only

Pipelines and JSON handling problem

  • 1.  Pipelines and JSON handling problem

    Posted 09-18-2020 12:18
    Edited by Jeff Peterson 09-18-2020 13:31





    Hello,

    I'm trying to build a pipeline to correlate dispatches from a third party service to records in our quickbase app.

    I've got the whole thing working except that I cannot seem to get the JSON response to filter or work correctly in pipelines.

    A sample of the response JSON schema is below:

    {
    "id": 11263767,
    "name": "09/21/2020 - 3:00 pm #71444",
    "namespace": "http://www.xxxxxxxxxxxx.com/xforms/4ae3ffa0-4f0a-0136-d47b-22000ab73707?32e9daf0-d9b5-0138-21e0-021422655351",
    "version": "1.01",
    "organization_id": 48656,
    "device_id": 414901,
    "description": "Break / Fix- Repair",
    "parent_form_id": 7229145,
    "parent_form_version": "1.14",
    "created_at": "2020-09-15T19:11:36Z",
    "updated_at": "2020-09-15T19:11:36Z",
    "scheduled_at": "2020-09-15T19:11:36Z"
    }

    So when I do this JSON fetch request,   it returns an array of all outstanding dispatches.       

    What I want to do is use the quickbase record number to reference the 'name' by finding the quickbase record number contained in the value like this:  "name": "09/21/2020 - 3:00 pm #71444".

    Next, I want to take the fields "id": 11263767, and "device_id": 414901, and update fields on the triggering record in quickbase with those values.

    The problem I'm having is that everything works up until it finds the JSON objects,  but I cannot seem to get the pipeline to find the correct JSON object to use in subsequent steps.   It either finds no objects that match or tests again every object in the array which I don't think will work because it will use up all of my steps.

    My pipeline looks like this:

    1.  Record Created
    2.  Pause 4 mins  (to allow this to change to make it to the third party system)
    3.  Fetch JSON  (this pulls a list of all active dispatches via API call)
    4.  Iterate over JSON records 
    For Each> Do> If>   'Name' contains {{quickbase item #}}
    5. Update Record in QB,   id and device Id

    Any ideas or help would be greatly appreciated.

    UPDATE:  Ok I have it working correctly as should be expected from that setup,  but the problem is that because step 4 looks at each record in the JSON array to find the one that matches,  it's using potentially hundreds of steps everytime the pipeline runs.    

    Any ideas on how I could do this with a smaller number of step runs?

    Thanks!




    ------------------------------
    Jeff Peterson
    ------------------------------