setValue in select box in catalog client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2025 08:39 PM
I have 2 region field with value as "NA" for "North America.
I am using catalog client script to fix value of first region into another and second one is read-only
But it is not updating. What wrong I'm doing?
var regions = g_form.getValue("u_region").toString();
I used g_form.setValue("u_region_1", regions );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2025 10:50 PM
g_form.addOption('u_region', 'region' , '');
Thanks
dgarad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2025 11:00 PM
why are you comparing 3 in the IF?
please share the latest script and choice values for both the fields
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2025 11:43 PM
We have a variable "Specify the request" . If this field value is 3 then, whatever in "u_region" select box, it should be copied to "u_region_1" selectbox. Below is the choice list of "u_region" and "u_region_1" selectbox.
var cont= g_form.getValue("specify_the_request");
var regions = g_form.getValue("u_region");
alert("Region is-"+regions );
if(cont ==3){
alert("inside")
g_form.setValue("u_region_1", regions);
}
else{
g_form.clearValue("u_region_1");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2025 11:51 PM
why to have same value again in 2nd variable?
Is this a business requirement?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2025 12:25 AM
yes, this is business requirement. First region is selected at initial stage. Second region field is at 25th position.