Make your installation page dynamic without html?

Hey Community,

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?

Thank you and all the best,
Tom

1 Like

no, it is not possible, data-bind will only work on domain name and API key and not for account products

yes, you can use the dynamic options to prepopulate fields.

Hope it helps :slight_smile:

let me know if you need more information on the dynamic options.

Thanks

1 Like

Hello @Santhosh
Thank you for your answer.

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

The renderApp is called on initialization:

app.initialized()
  .then( 
  function(_client) {
    window.client = _client;
    console.log("app initialized");
    renderApp().then(function (value) {
      loggedInUser = value[0].loggedInUser;
      domainName = value[1].domainName;
      console.log("app initialized with user " + loggedInUser.id);
    }).catch(err => handleErr(err));
  },
  function(error) {
    console.log(error);
  })
  .catch( err => console.log(err));

Is it not possible to use the data.get function in iparams.js?
Or do I have an error in my code?

@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.

Hope it helps :slight_smile:

1 Like

Hello @ThomasH

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().

Do let us know if this helps.

1 Like

Hey @satwik,

thank you for your response.

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?

1 Like

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.

1 Like

Thank you @Raviraj

I already do :slight_smile:

1 Like

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