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
- Create Query for a REST API REsource
- Set the Action type to POST
- Set the Body to JSON
- Set the text property to something that will be populated by a JavaScript query using AdditionalScope (example below)
- Load the Application
- Observe that the console displays an Error due to the variables not being defined
- 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.