How to populate overall status of status report based on schedule, cost ,resources, scope
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2024 02:10 AM
How to populate overall status of status report based on schedule, cost ,resources, scope and also selection of overall red if choices like options 1 ,2 3 present in overall status section i have a requirement like below.
I used below before/after business rule but not working please help on this..
var redCount = 0;
var yellowCount = 0;
// Get the category statuses
var categories = [gr.schedule, gr.cost, gr.resources, gr.scope]; // Replace with the actual field names
// Count red and yellow categories
for (var i = 0; i < categories.length; i++) {
if (categories[i] == 'red') {
redCount++;
} else if (categories[i] == 'yellow') {
yellowCount++;
}
}
// Logic for setting overall status based on the selected red choice
switch (gr.u_overall_red_if) { // Replace 'overall_red_choice' with the actual field name
case '1':
if (redCount >= 1) {
gr.overall_health = 'red'; // Replace 'overall_health' with the actual field name
}
break;
case '2':
if (redCount >= 1 || yellowCount >= 2) {
gr.overall_health = 'red';
}
break;
case '3':
if (redCount >= 1 || yellowCount >= 3) {
gr.overall_health = 'red';
}
break;
case '4':
if (redCount >= 1 || yellowCount >= 4) {
gr.overall_health = 'red';
}
break;
default:
gr.overall_health = 'not red'; // Or whatever default status you prefer
}
// Update the record
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2024 04:31 AM
Hello Team,
Can anyone help on this requirement please.