postSubmit Hook

Comments

4 comments

  • Tyler Lamparter Principal Product Manager
    Awesome Follow-up
    Engaged
    Top Contributor
    Answer Pro
    Celigo University Level 4: Legendary

    Michael Gantt that is correct. Hooks run on the entire page of data so that you can easily perform any action against all records. For postSubmit, here is an example of me filtering 1 of 2 records and this is the input of my postSubmit script. You can see that everything is available prior to mapping (in my preMap array), then it gets filtered and the postMap array has the second record as null since it was filtered out. Lastly, in the responseData, you have an ignored boolean field if it was ignored, but no ignored field if it wasn't. The index position of all these arrays align to each other.

    {
        "preMapData": [
            {
                "test": 1
            },
            {
                "test": 2
            }
        ],
        "postMapData": [
            {
                "test": 1
            },
            null
        ],
        "responseData": [
            {
                "statusCode": 200,
                "_json": {
                    "test": 1
                },
                "_headers": {
                    "date": "Fri, 14 Jun 2024 14:24:10 GMT"
                },
                "errors": []
            },
            {
                "statusCode": 200,
                "_json": {},
                "ignored": true,
                "errors": []
            }
        ],
        "settings": {
            "import": {}
        },
        "configuration": {},
        "_connectionId": "637527a77f409d08acc91d00",
        "_flowId": "666c5208ca868a0797b98842",
        "sandbox": false,
        "testMode": false,
        "_importId": "666c522077c163306fa42cf7"
    }

    0
  • Michael Gantt
    Engaged
    Celigo University Level 4: Legendary

    Thank you, that helped me get what I needed.  In the flow example you sent, how did you get the sample data at the exact spot you wanted (the postSubmit input)?

    0
  • Tyler Lamparter Principal Product Manager
    Awesome Follow-up
    Engaged
    Top Contributor
    Answer Pro
    Celigo University Level 4: Legendary

    Michael Gantt in the script, I added console.log(JSON.stringify(options)); as the first line in my function, then I ran the flow, went to the scripts tab on the flow, clicked the 3 dots, clicked view execution log, and clicked refresh.

     

    0
  • Michael Gantt
    Engaged
    Celigo University Level 4: Legendary

    Perfect, thanks again!

    0

Please sign in to leave a comment.