- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2025 11:21 AM - edited 01-14-2025 11:23 AM
I have a catalog item with a multiple choice variable for the user to select which license type they are requesting (see variable configuration below. I want the price on the RITM to be set as the value in the Recurring Price associated with the option the user selects
How do I set the Price field on the RITM from the option they select?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2025 01:13 PM
The issue seems to lie in your script logic and possibly in your understanding of the variable relationship and how question_choice stores data.
Here is a sample query:
(function executeRule(current, previous /*null when async*/) {
// Create a GlideRecord for 'question_choice' table
var type = new GlideRecord('question_choice');
// Add query to find the correct choice based on question and selected value
type.addQuery('question', '3D2826f6164707d214384e47eb616d4357'); // Replace with your actual variable sys_id
type.addQuery('value', current.variables.license_type); // Match the value selected by the user
// Execute the query
type.query();
// If a matching record is found, retrieve the price
if (type.next()) {
var licprice = type.recurring_price; // Ensure you are fetching the correct field (recurring_price in this case)
current.price = licprice; // Set the price on the RITM
}
})(current, previous);
ɪꜰ ᴍʏ ᴀɴꜱᴡᴇʀ ʜᴀꜱ ʜᴇʟᴘᴇᴅ ᴡɪᴛʜ ʏᴏᴜʀ Qᴜᴇꜱᴛɪᴏɴ, ᴘʟᴇᴀꜱᴇ ᴍᴀʀᴋ ᴍʏ ᴀɴꜱᴡᴇʀ ᴀꜱ ᴛʜᴇ ᴀᴄᴄᴇᴘᴛᴇᴅ ꜱᴏʟᴜᴛɪᴏɴ ᴀɴᴅ ɢɪᴠᴇ ᴀ ᴛʜᴜᴍʙꜱ ᴜᴘ.
ʙᴇꜱᴛ ʀᴇɢᴀʀᴅꜱ
ꜱʀᴇᴇʀᴀᴍ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 07:17 PM
your BR script is wrong
Please enhance it
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-21-2025 05:45 AM
@Ankur Bawiskar do you have any suggestions for what needs to change?