Can i show template inside a variable

Debasis Pati
Tera Guru

Hello All,
I want to have a template where i will have some patient details.
like name ,age,gender like these will be questions.
and these questions even i can store in a table as well i have a custom table even i can reuse that if we need.

My requirement is when i select option insurance type as health for example i have a variable called patient details these template questions should be applied and user should be able to select also and fill it .
Can i achieve this somehow either by using multiline variable set or using templates or something.

@Ankur Bawiskar any suggestions?

9 REPLIES 9

@Debasis Pati 

yes MRVS is an option

💡 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  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hello @Ankur Bawiskar ,
How i can limit only one entry after that disable the add button in the mrvs?

DebasisPati_0-1768915842959.png

I checked the below link and tried one solution its not working
https://www.servicenow.com/community/developer-articles/disable-buttons-in-multirow-variable-set/ta-...

i tried the below script

function onLoad() {
   //Type appropriate comment here, and begin script below
  
var my_var = g_form.getField('testingone');
my_var.max_rows_size = 0;

   
}

@Debasis Pati 

in the MRVS variable attribute add this max_rows=1

AnkurBawiskar_0-1768916478147.png

 

💡 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  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

VaishnaviK43271
Tera Contributor

Hi @Debasis Pati !!

 

Yes, this requirement can be achieved in ServiceNow, but with an important design consideration.

ServiceNow does not support dynamically creating catalog variables at runtime from a table. Catalog questions must exist at design time. However, you can still meet your requirement using Variable Sets or Multi-Row Variable Sets (MRVS) with conditional visibility.

Recommended Approach

  1. Create a Variable Set (template)

    • Create a Variable Set called Patient Details

    • Add questions like Name, Age, Gender, DOB, etc.

    • This acts as your reusable template

  2. Add Insurance Type variable

    • Create a choice variable insurance_type (Health, Life, Vehicle, etc.)

  3. Attach the Variable Set to the Catalog Item

    • Add the Patient Details Variable Set to the item

    • Keep it hidden by default

  4. Use a Catalog UI Policy

    • Condition: insurance_type = Health

    • Action: Show the Patient Details Variable Set

    • Else: Hide it

When the user selects Insurance Type = Health, the patient detail questions are displayed and can be filled in.

If Multiple Patients Are Required

If one request can include multiple patients, use a Multi-Row Variable Set (MRVS) instead of a normal Variable Set. Each row represents one patient.

Storing Data in a Custom Table

You can store the submitted patient details into your custom table using:

  • Flow Designer (recommended), or

  • A Business Rule on the request

 

Mark this as Helpful if it clarifies the issue.
Accept the solution if this answers your question.

Regards,
Vaishnavi
Associate Technical Consultant

Dr Atul G- LNG
Tera Patron

I don’t think we can call a template from a variable. You need to use the variable only to get the data in MRVS form.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************