Help in my code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 12:32 PM
I'm trying to create a code where, every time a ticket is created, the queue field is updated, and as it's going to be a lot, I thought about creating a client script instead of using flow, + I'm not able to change the queue field
// Client Script to direct a ticket to a queue based on the fields filled in the catalog tree
function onSubmit() {
var area = g_form.getValue('area');
var system = g_form.getValue('system');
var serviceType = g_form.getValue('service_type');
// Determine the queue based on the field values
var queueValue = determineQueue(area, system, serviceType);
// Update the 'Queue' field with the correct value
g_form.setValue('queue', queueValue);
}
// Function to determine the queue value based on the field values
function determineQueue(area, system, serviceType) {
// If the area is TI, the system is "app", and the service type meets the criteria
if (area === 'ti' && system === 'app' &&
(serviceType === 'maintenance_ti' || serviceType === 'installation_ti' ||
serviceType === 'configuration_ti' || serviceType === 'customization_ti')) {
return 'app_n1'; // Queue value for app_n1
}
// If no case matches, do not return anything
return ''; // Returns an empty string when no case matches
}
if the area field is 'ti' and if the system field is 'app' what if the service_typer field is any of: malntenance_ti, installation_ti, configuration_ti, customizetlon_ti, the queue value must be app_n1

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 12:39 PM
Is this 'Queue' field on the record producer form that is submitted to create the ticket record? If it is not on the record producer form, then you will need to add it to the form (and hide it via catalog UI policy if it shouldn't be visible) for it to be available to set from client script.
Regards,
Chris Perry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 01:07 PM - edited 05-06-2024 01:11 PM
This field is of type choice, I created it in the application via Studio

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 01:45 PM
How are you creating the record? Is it from a record producer or are you just creating a new record from the back-end w/ New button?
Regards,
Chris Perry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 09:37 AM
Dude, I made the queue field where it has these options, it's just a form option created in studio that I'm trying to make a client script