How to fetch price of a catalog item which can vary based on variable values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2020 10:59 PM
In my catalog form, there is a list collector where we can select multiple values and each value has a price that will add up to the price of the catalog item. This functionality is working fine. The catalog item price is increasing as per the value selection. But I need to make a variable mandatory and visible if the price exceeds 2500$ before form submission...
Any idea how can I achieve this.
- Labels:
-
Request Management
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2020 03:05 AM
Hi Subhajit,
Did you try writing an onSubmit catalog client script?
something like this:
var price = g_form.getValue('price variable name');
if(price>2500);
{
g_form.setDisplay('variable name you want to make visible',true);
g_form.setMandatory('variable name you want make mandatory',true);
}
else
{
g_form.setMandatory('variable name you want make mandatory',false);
g_form.setDisplay('variable name you want to make visible',false);
}
Mohit Kaushik
ServiceNow MVP (2023-2025)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2020 03:28 AM
Hi,
I am not able to fetch the price. Thats where I am facing the issue. I have not created a variable for price.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2020 03:44 AM
Hi,
You need not create a new variable for price, it is getting calculated right once you select the items, then fetch that value only.
I think the value you can get by g_form.getValue('price');
Thanks,
Mohit Kaushik
Mohit Kaushik
ServiceNow MVP (2023-2025)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2020 04:01 AM