Help with GlideScript logic for displaying Service Offers based on Warranty and Uplift TAT values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
Hi everyone,
I'm new to ServiceNow developement and working on a requirement where I need to display service offers on the front end based on values from the u_offer_id table. Specifically, I want to conditionally show warranty and additional service offer options depending on the Warranty AUD and Additional AUD values.
Here are the two scenarios I'm trying to handle:
- Scenario 1
GetService response contains Warranty details with AUD = 001, with AUD > 001 AND AdditionalServicesDetail with AUD = 001
Expected Result: when Order ID created, and after offer selected, on back end, Offer IDs are :
- WarrantyDetails with AUD =001
- WarrantyDetails with AUD > 001
- AdditionalserviceDetails with AUD =001.
On Front End, Service Offer displayed are:
- Warranty Service Option(s) with SLA = 1 Day
- Warranty Service Option(s) with SLA > 1 Days
Additional Service Option is not displayed.
- Scenario 2
GetService response contains WarrantyServiceDetails with AUD > 001 AND AdditionalServicesDetail with AUD = 001
Expected Result: when Order ID created, and after offer selected, on back end, Offer IDs are :
- WarrantyServiceDetails with AUD > 001
- AdditionalserviceDetails with AUD =001.
On Front End, Service Offer displayed are:
- Warranty Service Option(s) with SLA > 1 Days
- AdditionalserviceDetails option with SLA = 1 Day is displayed.
var grOfferId = new GlideRecord('u_offer_id');
grOfferId.addQuery('u_order_number', order);
grOfferId.query();
if (grOfferId.next())
{
data.serviceTypeFilter = '';
if (grOfferId.u_order_type == 'Warranty')
{
}
Can someone help validate if this logic correctly handles both scenarios?
Any suggestions to improve or optimize this would be greatly appreciated!
Thanks in advance 🙏