Unable to define postConfigs function in iparams.js as async

I would like to have an async postConfigs funcion in my iparams.js file, since I would like to fetch some data from an API and save it as an iparam. the function only needs the credentials the user input into the other fields.
If this function is defined as aync however, an error is logged into the browser console and the function doesn’t work.

Here is a simple example of what I would like to do:

async function postConfigs() {
…get values of input fields, mainly credentials…
const response = await client.request.invokeTemplate(“fetchSomeData”, {
…credentials from the fields above… })
…extract attribute from response and save as iparam…
}

Hi Christopher,

You can work around this limitation by making the same API call within the validate() function and assigning the result to a global variable. Then, you can reuse that variable in the postConfigs() function.

Thanks, this seems to work without problems

1 Like

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