- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2015 01:31 PM
Is there any way to access a given request item's variables in the Service Catalog via script, before that user checks out (that is, before the REQ and RITMs are created)? I want to perform some validation, but I need to grab a value from one of the mandatory reference field variables that belongs to a Catalog Item.
I've looked through all of the OOB Script Includes involving Service Catalog cart manipulation, as well as the sc_cart_item table and various other tables. No leads yet. Is anyone willing to shed some light on this issue?
I know the values are stored somewhere -- as they can be displayed from the 'Edit Cart' page. Are these values accessible via script, or is the code to access these values at this point not exposed?
Thanks!
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2015 04:40 PM
Hi Andrew,
You should be able to get at them, the items in the cart are linked to the sc_cart records.
If you look at one of these (on sc_cart_item) they have the variables for the item listed and they reside on sc_item_option.
These sc_item_option records are linked back to the cart item via the "cart_item" field (display value is the sys_id of the cart item record)
You should be able to put a query together that will grab the cart, find the item, and get the variable value.
Hope that helps.
R
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2015 11:37 AM
This was very helpful, thanks for sharing!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2016 12:10 PM
Thanks Russell and Andrew. I had the exact same need and combined both of your answers into a working solution for my needs. It works perfectly!
Thanks for sharing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2015 06:05 PM
Hello, it sounds like you can accomplish the validation that you want to perform through an OnSubmit "Catalog Client Script".
You can access the catalog item variable by doing a:
g_form.getValue('your_variable_name');
Hope it helps!
Thanks,
Berny