is it possible to load the account’s products into the installation page (non-html)?
I alredy did it with building a complete own HTML installation page, but I am curious, if there maybe is an option to do with less scripting?
So what I try to achieve is, that you can choose the products (we have around 40) via Multi-Select dropdown, for which a specific process should be triggered.
What does the data-bind option in iparams.json offer? In the documentation it says: Product values (domain name, API key, or complete web-address associated with an account) used to pre-populate an iparam field.
Can I bind the account’s products aswell?
Or can I use the dynamic options for the standard installation page to achieve what I want?
I tried a bit with the dynamic options, but I don’t exactly know, what I can use in the iparams.js.
For example, I already know that I can use the client.request functions.
I use it to get ticket field values after the api key was set.
But what is not working is a client.data.get call, so this code part:
function renderApp() {
return Promise.all([client.data.get('loggedInUser'), client.data.get('domainName')]);
}
does come back with this error message:
TypeError: Cannot read properties of undefined (reading ‘get’)
at renderApp (iparams.js:18:35)
at iparams.js:6:5
@ThomasH,
You are not able to use Data-API in Iparams, only request API and SMI are supported.
Alternatively, you can use product API to get the details that you want.
You appear to be on the right track with respect to using the dynamic installation page capability to achieve this.
Have you checked out this sample app for reference? If not, let me point you at the config folder here where you will find an example of a change event associated with an iparam property and a handler attached to the event in assets/iparams.js.
As @Santhosh suggested, Data Methods are not currently available in the installation page. You must instead make a REST API call to get this data back from the handler. If you need to reference other parameters (API-key, domain) to make the request, you will want to use utils.get() to get their current values, and set the options for your drop-down using utils.set().
I’ll not following the dynamic logic anymore, as I need to go a bit more complex.
Originally, I wanted to put all the products into six multiselect dropdowns, as I wanted to build a matrix of six items (let’s call them payment options) x 40 products (which are our retail shops).
But when going that way, I’d have to load 6 iparams (for each payment option) in the app itself, when trying to check for, which paym. options are allowed in a specific product/shop.
Now I am doing the other way round, so in the configuration, I put 40 dropdowns, which all include these 6 payment options (where 1…6 are allowed per product/shop).
This makes the configuration a bit more complicated (and even a bit more dynamic, as new shops come in regularly), but I only have to get one iparam in the app (the payment option set for exactly this product/shop).
Which means, now I have to get all the products and build these dropdowns dynamically.
Which means, I can’t go for dynamic options and I have to build iparams.html.
Or would it even be possible to make new Iparam fields in a dynamic way with just iparams.js?
It’s not possible to create an iparam field dynamically with dynamic iparams with iparam.js. Only existing fields can be modified with various functions and event callback available.
You would have to go for the Custom Installation page (iparams.html) for this use case.