My iparams.json contains param like this:
"setFieldsMapping": {
"display_name": "Want to map field?",
"type": "checkbox",
"default_value": false,
"events": [
{"change": "setFieldsMappingChange"}
]
},
"destinationField": {
"display_name": "Choose field to save value",
"description": "Choose field to save value",
"type": "dropdown",
"required": false,
"visible": false,
"options": [], //would like to set option with list of custom fields
"default_value": []
}
Than inside iparams.js I would like to retrieve from Freshsales account list of Custom Fields using API call e.g. client.request.invokeTemplate(…)
function setFieldsMappingChange(arg) {
let myCustomFields = await client.request.invokeTemplate("getCustomFields", {})
utils.set("destinationField", {Values: [myCustomFields]})
}
but I receive error:
Uncaught TypeError: Cannot read properties of undefined (reading 'request')
at setFieldsMappingChange (iparams.js:37:19)
Is it possible without creating custom iparams.html page?