HTTP request send conditional request body values
Con rispostaWhen I make an HTTP call from values in a csv file is there a way to easily sent values conditionally? For example, if the user enters something in the spreadsheet then put that value in the body, if they enter nothing don't send anything for that value. Any advice on how to accomplish this? Thanks!
Example 1, user enters caboProjectBudgetOwner in spreadsheet
{
"caboProjectBudgetOwner":"$(data.command.output.2972c7fd-5a70-4c2b-81b9-2c80b03532be.value)"
,"__FLEX_Context":null,"__FLEX_Context_DisplayValue":null
}
Example 2, user enters both caboProjectBudget Owner AND caboSpendCategory in spreadsheet
{
"caboProjectBudgetOwner":"$(data.command.output.2972c7fd-5a70-4c2b-81b9-2c80b03532be.value)"
, "caboSpendCategory":"$(data.command.output.2972c7fd-5a70-4c2b-81b9-2c80b03532be.value)"
,"__FLEX_Context":null,"__FLEX_Context_DisplayValue":null
}
-
Michelle Haynes I recently covered how you could use Handlebars to do this kind of thing. If you convert your csv (I assume from a Workiva - Get Sheet Data command) to JSON, and pass it to a "Handlebars - Render Text Template" command, you can use the conditional {{#if}} functionality to build the body of your HTTP call.
Wade
--
Wade Hays - https://towerturn.com/services/dedicated-expert 1Hi Michelle Haynes,
As Wade mentioned above, Handlebars would be great for solving this. Below are two additional Handlebars resources that I recommend reviewing:
0Accedi per aggiungere un commento.
Commenti
2 commenti