Adding a table to a record producer/catalogue item

samirmeroua
Tera Contributor

Hello 

 

I building a catalogue item, in the form, the business requested to add something like a table in the screenshot, where the cells, under the Options header are drop down options, and the cells under Locations are reference tables. Days are prefilled, read only.

I know I need to do it via multi-row variable set, but I could not get the days prefilled as shown in the screenshot, Neither the Current or New rows.

Any catalogue script? or different approach if something like this exists ?  

 

1 ACCEPTED SOLUTION

Ankith Sharma
Tera Guru

Hi @samirmeroua 

MRVS is likely the best fit for this requirement. However, there is currently no out-of-the-box way to automatically pre-populate an MRV with fixed rows when the catalog item loads. While variable default values can be configured, they only apply to fields within an existing row and do not create rows automatically.

 

If the row structure is static and unlikely to change, you may want to consider using standard catalog variables or a custom UI (such as a Service Portal widget or UI Builder component) instead of an MRV. This approach is often simpler to maintain and provides a better user experience for grid-based data entry.

 

If MRVS is a hard requirement, the typical approach is to use a Catalog Client Script to populate the MRVS JSON and programmatically create the required rows when the form loads. For a schedule style layout with fixed days and predefined row categories, a custom UI solution is generally more user friendly than trying to replicate spreadsheet behavior within an MRVS.

 

If you found this useful, feel free to mark it as Accept as Solution and Helpful. It makes my day (and helps others too 😉).

 

Regards,
- Ankit
LinkedIn: https://www.linkedin.com/in/sharmaankith/

View solution in original post

4 REPLIES 4

Ankith Sharma
Tera Guru

Hi @samirmeroua 

MRVS is likely the best fit for this requirement. However, there is currently no out-of-the-box way to automatically pre-populate an MRV with fixed rows when the catalog item loads. While variable default values can be configured, they only apply to fields within an existing row and do not create rows automatically.

 

If the row structure is static and unlikely to change, you may want to consider using standard catalog variables or a custom UI (such as a Service Portal widget or UI Builder component) instead of an MRV. This approach is often simpler to maintain and provides a better user experience for grid-based data entry.

 

If MRVS is a hard requirement, the typical approach is to use a Catalog Client Script to populate the MRVS JSON and programmatically create the required rows when the form loads. For a schedule style layout with fixed days and predefined row categories, a custom UI solution is generally more user friendly than trying to replicate spreadsheet behavior within an MRVS.

 

If you found this useful, feel free to mark it as Accept as Solution and Helpful. It makes my day (and helps others too 😉).

 

Regards,
- Ankit
LinkedIn: https://www.linkedin.com/in/sharmaankith/

Thanks Ankit 

 

I was able to create the desired table and add it to catalogue item 

I had to create a single line variable set, add a variable type as Custom, in Type Specification related list, I select the widget I created in the Support portal (I had to do some HTML, SCC and script coding) 

Thanks for sharing your solution @samirmeroua . Using a Custom Variable together with a Service Portal widget provides much greater flexibility and control over the user experience compared to MRVs, especially for grid style requirements that need pre-populated rows, custom validation, or specialised behavior. This approach can be a practical alternative for others facing similar requirements.

 

Warm Regards,
Ankit

Tanushree Maiti
Tera Patron

Hi @samirmeroua 

 

My design is something like this,

 

  1. Create a Multi row variable
  2. Create a select box variable Day with Choices
  • Monday
  • Tuesday
  • Wednesday
  • Thursday
  • Friday
  • Saturday
  • Sunday

 

3. Create a select box variable Option with Choices

  • Option1
  • Option 2
  • Residence

 

4. Create reference variable varLocation1 ( Question : Location) , reference table cmn_location

5. Create reference variable varLocation2 ( Question : Location) , reference table u_custom_table

6. Create a single line Text Variable : Residence

7. Create two check box variables AM and PM ( Add validation- 2 can not be checked at same time)

 

8.a. Create a catalog UI policy in the variable set

   - condition: option is option1

   Using ui policy Action , varLocation1 is visible.

                                                    varLocation2 is NOT visible

                                                     Residence is not visible

  1. b. Create a Catalog UI policy in the variable set

   - condition: option is option2

   Using ui policy Action , varLocation1 is NOT visible.

                                                    varLocation2 is visible

                                                     Residence is not visible

  1. c. Create a catalog UI policy in the variable set

   - condition: option is Residence

   Using ui policy Action , varLocation1 is NOT visible.

                                                    varLocation2 is NOT visible

                                                     Residence is visible

 

Note: this design has been  drafted  by seeing your Monday related sample values. If for other day , you have other option, Update it.

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti