HI All
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2024 10:07 PM
HI All,
I Have Created one Field that is Due Date Field
whenever 0-7 goes to user manager Approval
8-infinite days goes to it manager Approval
how to Develop this code in workflow use if-else code
Please suggest me
Thanks ADV
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2024 10:17 PM
HI @basha shaik you can use if activity to check,
answer = ifScript();
function ifScript() {
var dueDate = current.date;
var checkDays = parseInt(dueDate); //convert to integer
if (checkDays <= 7) {
return 'yes';
}
return 'no';
}
Regards
Harish
Harish
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2024 11:43 PM
Hi @basha shaik
providing the pseudo workflow code for your if-else requirements.
// Calculate the difference in days between the current date and the due date
daysUntilDue = calculateDaysUntilDue(dueDateField)
// Decision-making process
if (daysUntilDue >= 0 and daysUntilDue <= 7) {
// If the due date is within 0-7 days, seek approval from the user manager
redirectToUserManagerApproval()
} else if (daysUntilDue >= 😎 {
// If the due date is 8 days or more away, seek approval from the IT manager
redirectToITManagerApproval()
} else {
// Handle cases where the due date might be in the past or invalid
handleInvalidDueDate()
}
Note: Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help us a lot.
Thanks & Regards
Deepak Sharma