Errors in Console with Resource Queries that contained variables which are populated by AdditionalScope

Goal

To be able to use Resource Queries that will have the body of the request populated by AdditionalScope without console error.

I'd like to know how can I create these types of queries without encountering a console error.

Steps

  1. Create Query for a REST API REsource
  2. Set the Action type to POST
  3. Set the Body to JSON
  4. Set the text property to something that will be populated by a JavaScript query using AdditionalScope (example below)
  5. Load the Application
  6. Observe that the console displays an Error due to the variables not being defined
  7. Have to check the console in case it's an issue, find out it's not

Details

Example JSON text property value:

"{{ `${time} - ${user} submitted a report generation request for ${companyName} (${companyId}) for period ${start} to ${end}` }}"

Example JavaScript query:

notifyGoogleChat.trigger({
  additionalScope: {
    time: new Date().toLocaleString(),
    user: current_user.email,
    companyId: getAccount.data.companyId[0],
    companyName: getAccount.data.companyName[0],
    start: dayjs(startDate.value).format('DD MMM YYYY'),
    end: dayjs(endDate.value).format('DD MMM YYYY')
  }
});

Screenshots

Screenshot showing the JSON text definition and presence of the console error on application load.

How about:

{{ String( time == undefined ? “” : ${time} - ${user} submitted a report generation request for ${companyName} (${companyId}) for period ${start} to ${end} )}}

In which case you can also remove the quotes around the JS block in your API JSON.