I have a case where I’ll be pre-populating an input field in the iparams.html page with the API key (using data binding).
However, the input field only gets pre-populated during the very first installation but after that, it does not get pre-populated as required.
Does data binding only work during the first installation? Please let me know.
Yeah, Saif. We have an input field for getting the logged-in user’s API key using data binding. This field is not pre-populated when the admin opens the settings page to change the parameters.
Since this information is already stored as installation parameters in the app, we can retrieve them and at runtime by making the installation page dynamic.
iparams.json
"api_key": {
"display_name": "Freshdesk apikey",
"description": "freshdesk API requires app calls to include API keys in all of their requests",
"secure": true,
"type": "text",
"data-bind": "product.api_key", // Using data-bind
"required": true
},
"creatorDomain": {
"display_name": "Who is creator of Ben 10 cartoon series",
"type": "domain",
"description": "devrel",
"data-bind": "product.domain", // Using data-bind
"type_attributes": {
"product": "freshdesk"
}
iparams.js
async function onFormLoad(){
let client = await app.initialized();
let installedDomain = await client.iparams.get("domain"); // domain is installation parameter in iparams.json
utils.set("domain", {value: installedDomain };
}
Does the data-bind feature only works once during the installation by design? Or is it a bug?
If @Clement_Franklin wants to autopopulate a secure installation parameter whenever user opens up app installation page consequent times post installation, how can one do it?
Do you mind letting us know what is helpful to the user when API key is prepopulated during configuring the app? Do you see the user wanting to change the API key often?