Legacy Dev Forum Posts

 View Only

Sign Up

Creating Action requestTemplate with multiple inputs

  • 1.  Creating Action requestTemplate with multiple inputs

    Posted 06-05-2025 18:47

    Duncan_Stewart | 2017-10-24 17:38:39 UTC | #1

    I've worked out the kinks in my first web service Action, retrieving add'l information from Salesforce, and now I want to create a follow-on Action to complete the interaction, but this 2nd service requires multiple inputs.

    The first Action's requestTemplate looks like this:

    "requestTemplate": "{\"contactId\": \"${input.ContactId}\"}"

    similar to the existing Salesforce Data Actions, with a single parameter/input. If I want to pass multiple parameters, what does that look like? It appeared ^ to be a single pari of strings w/ escaped quotes, inside parentheses,

    Not this, apparently:

    { "requestUrlTemplate": "/services/apexrest/submitIVRInventory/submitInventory", "requestType": "POST", "headers": { "Content-Type": "application/json" }, "requestTemplate": "{\"contactId\": \"${input.ContactId}\"}", "{\"isPureFlow\": \"${input.isPureFlow}\"}" }

    though it appears to be the closest I've come. The error is on the 2nd line and reads as follows:

    Parse error on line 8: ...put.isPureFlow}\"}"} ----------------------^ Expecting ':', got '}'

    got '}'


    Duncan_Stewart | 2017-10-24 17:58:03 UTC | #2

    It's possible that the requestTemplate must be on a single line, and look something like this (without the wrapping due to line length):

    "requestTemplate": "{\"contactId\": \"${input.ContactId}\",\"isPureFlow\": \"${input.isPureFlow}\"}"

    By 'possible', I mean that it's passing now; we'll see how it goes adding the next 7 params and actually testing it :D


    Jason_Mathison | 2017-10-24 18:02:48 UTC | #3

    I highly recommend using a tool to help you escape your JSON. One example is https://www.freeformatter.com/json-escape.html#ad-output

    I looked like on your first post you were putting your values into different objects (here is the unescaped version) "{"contactId": "${input.ContactId}"}", "{"isPureFlow": "${input.isPureFlow}"}"

    I would assume that you actually wanted them in one object, which would mean getting rid of the final } on the first line along with the { at the start of the second line.


    Duncan_Stewart | 2017-10-24 18:12:29 UTC | #4

    Yes, it took a few iterations to figure out where the object definition ended -- I 'had it right' early on, but I had separated it out into separate lines for readability, and it wasn't 'til I addressed that that it worked.

    I appreciate the tool, though -- I'll probably come back to it!

    Duncan


    system | 2017-11-24 18:12:37 UTC | #5

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 2000