How to autofill mrvs variable with signleline text
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2024 01:39 AM
In the catalog there are Q1 and Q2. Q1 is a yes/no type and Q2 is MRVS.
there are 3 variables in the MRVS.
If I select "yes" in the Q1 then some default text "text123" need to be filled in the 3rd variable in the multi row variable set. Can anyone help me with the script for this.
thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2024 01:45 AM
Hi @Ak8977
I am not 100% sure but thinking for low code, I might be wrong
Created UI policy
On Q1 - if yes, then show Q3 and in that variable use the default value
This can be a workaround.
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/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2024 01:51 AM
Hello @Dr Atul G- LNG ,
if I create one more question for that it won't required default value in that case it won't work. So if there is any script share it with me . It would be helpful for me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2024 01:57 AM
Hi @Ak8977
You can use g_service_catalog API to modify data within the MRVS based on the value of a field on the parent catalog item form. Refer the official documentation and give it a try :
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2024 02:14 AM
Hi,
You can create an onLoad Catalog Client Script for the variable set such that it fetches the value from the catalog item variable and sets the value for the MRVS variable.
function onLoad() {
if (g_service_catalog.parent.getValue("Q1") == "yes") { //Replace Q1 with the backend name of the field
g_form.setValue("mvrs_variable", "text123"); // Replace mvrs_variable with backend name of the field
}
}
If you find this helpful, please marks this as the solution. Thanks!