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-19-2020 11:09 PM
Hi,
Yeah I have tried calculating the price by fetching the values of the list collector and then calling a script include to actually add all the values.
I am able to fetch the total price in the onSubmit client script, but we actually need to restrict form submission when price exceeds 5000$. But the form gets submitted even if I am returning false.
Dont understand why is this happening.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2020 09:36 AM
Hi,
What type of method you are using to call back the script include. is getXML() or getXMLWait().
You have to use getXMLWait() when you are using onSubmit() client script. Because script include is used to let the client script do its work without waiting for the response to come from script include. And in case of onSubmit() client script if it is not waiting for the response to come from script include, it will just execute come out of form.
getXMLWait() forces the client script to wait for the response from script include.
Read below for more information.
Please mark my answer as correct and helpful if it solved the query and helpful alone if it lead you in right direction.
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:39 AM
Hi Subhajit,
You need to write UI policy to make variable mandatory and visible.
Give condition as price is greater than 2500 or you can also write script there.
I hope It will help you.
Regards,
Harshal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2020 05:30 AM
Hi,
No, actually catalog client script and catalog ui policy applies only to variables and not to fields on sc_cat_item form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2020 06:19 AM
Hi,
I have provided the script above, please try that and let me know.
Thanks,
Mohit Kaushik
Mohit Kaushik
ServiceNow MVP (2023-2025)
