How to dynamically populate multi‑select rule options in a Catalog Item using data from an API

srikanthvan
Tera Contributor

I’m building a Catalog Item where I need to pull data from an external API. I’ve already created the REST Message and HTTP Method, and I'm successfully able to fetch data of first 2 variables using a Script Include and a Catalog Client Script.

My Catalog Item has three variables:

  • Selection_of_site
  • prompt_selection
  • rules

The “rules” variable needs to display values returned from the external API based on selection of the site. The challenge is that the API can return dynamic values and the user must be able to select multiple rules.

However, the Catalog Item does not support a "(multi‑select choice)" variable type natively.

 

Please provide the information, How to configure it.

2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron

@srikanthvan 

you can have either of this approach

1) Approach 1 -> create custom table to hold the values returned from API and use List Collector type variable so that user can select multiple values

OR
2) Approach 2 -> create variable of type Custom with label and use widget to render those values and allow multi-select there

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

@srikanthvan 

Hope you are doing good.

Did my reply answer your question?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

6 REPLIES 6

Ankur Bawiskar
Tera Patron

@srikanthvan 

you can have either of this approach

1) Approach 1 -> create custom table to hold the values returned from API and use List Collector type variable so that user can select multiple values

OR
2) Approach 2 -> create variable of type Custom with label and use widget to render those values and allow multi-select there

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

@srikanthvan 

Hope you are doing good.

Did my reply answer your question?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur Bawiskar, thanks for your reply. Could you please help me with a detailed explanation of Approach 2? I haven’t created it before. I have added the custom field with label as the variable type, but I’m not sure how to use a widget to render those values and enable multi‑select. Thanks in advance.

Hi Ankur Bawiskar, thanks for your reply. Could you please help me with a detailed explanation of Approach 2? I haven’t created it before. I have added the custom field with label as the variable type, but I’m not sure how to use a widget to render those values and enable multi‑select.