script always looping to else loop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hello Folks,
I have written below code to set impact on incident based PRO/Non Prod value. but it always going to else loop. Please let me know what will error in below code.
var UrgencyPriority;
var incDesc = fd_data.subflow_inputs.ah_alertgr.additional_info;
//var incDesc = fd_data.trigger.current.additional_info;
var regEx = new RegExp('(?<="environmentName" : ).*', 'j');
var matchData = regEx.exec(incDesc);
var matchDateUp = matchData.toString().toUpperCase();
if(matchDateUp == "NON PROD") {
UrgencyPriority='2';
}
else{
var evntType = fd_data._6__look_up_record.error_message;
if (evntType == "No Record Found") {
UrgencyPriority='3';
}
else
{
UrgencyPriority = fd_data._5__calculate_values_based_on_the_alert.incidenturgency;
}}
return UrgencyPriority;
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @ack
Can you try below script,
var UrgencyPriority;
var incDesc = fd_data.subflow_inputs.ah_alertgr.additional_info;
try {
var parsedDesc = JSON.parse(incDesc);
var envName = parsedDesc.environmentName.toUpperCase();
if (envName === "NON PROD") {
UrgencyPriority = '2';
} else {
var evntType = fd_data._6__look_up_record.error_message;
if (evntType === "No Record Found") {
UrgencyPriority = '3';
} else {
UrgencyPriority = fd_data._5__calculate_values_based_on_the_alert.incidenturgency;
}
}
} catch (e) {
// Handle parsing error or missing environmentName
UrgencyPriority = '3'; // Default fallback
}
return UrgencyPriority;
Thanks,
Vignesh
"If this solution resolves your issue, kindly mark it as correct."