- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2023 10:34 PM - edited 06-18-2023 10:34 PM
Hi,
We have a variable in catalog item which is look up select box(country) to location table in this we have 3 question choices(1.India,2.China,3.Japan) if user select 1.India the order now button should be visible for remaining 2 values we need to hide the order now button on service portal
I have tried the below catalog On change client script it is not working kindly help on this how to achieve
alert('test');
var cntr = g_form.getValue('country');
if (cntr == 'India') {
$(sc_order_now_button).show();
$(sc_add_to_cart_button).show();
} else {
$(sc_order_now_button).hide();
$(sc_add_to_cart_button).hide();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2023 12:44 AM
are you sure you are comparing correct value
Since you said it's a lookup select box then it will hold sysId; so you compare the sysId and not the label
var answer = g_form.getValue("country"); // variable type is look up select box of location table
if (answer != 'sysIdOfIndiaRecord') {
var msg = getMessage("Request cannot be submitted due to the answer of User Details.");
g_form.addErrorMessage(msg);
return false;
}
}
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2023 01:51 AM
Now its working thanks Ankur