Priority to be updated before insert of a record in Case form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 11:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 12:07 AM
Hello @Community Alums
I have made small changes in your script. please try this out,
(function executeRule(current, previous) {
var categoryCritical = [68, 70, 71, 72];
var subcategoryCritical = [583, 595, 596, 597, 575, 581, 536];
var categoryModerate = [70, 71];
var subcategoryModerate = [598, 2052, 576, 582, 572, 574];
var categoryLow = [71];
var subcategoryLow = [577, 578, 579];
var categoryHigh = [72];
var subcategoryHigh = [535];
var cat = current.getValue('category');
var subcat = current.getValue('subcategory');
if (categoryCritical.indexOf(cat) !== -1 || subcategoryCritical.indexOf(subcat) !== -1) {
gs.info('Critical');
current.priority = 1;
} else if (categoryModerate.indexOf(cat) !== -1 || subcategoryModerate.indexOf(subcat) !== -1) {
gs.info('Moderate');
current.priority = 3;
} else if (categoryLow.indexOf(cat) !== -1 || subcategoryLow.indexOf(subcat) !== -1) {
gs.info('Low');
current.priority = 4;
} else if (categoryHigh.indexOf(cat) !== -1 || subcategoryHigh.indexOf(subcat) !== -1) {
gs.info('High');
current.priority = 2;
} else {
// If the category and subcategory don't match any predefined values, set the priority to a default value (e.g., 5).
gs.info('Default');
current.priority = 5;
}
})(current, previous);
if this helps you, Please mark my answer help and Accepted solution
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 12:22 AM - edited 07-25-2023 12:27 AM
Its showing as P5 for all, not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 01:08 AM
Can anyone tell me why its going to Else Condition?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 04:26 AM
This is resolved Now. I needed to do ParseInt for subctegory and Category. and check for > - 1 instead !==1