How to make comments mandatory in Employee Center Portal
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 06:46 AM
This is our Employee Center Portal:
When the caller decides to resolve the incident, a comment field should be mandatory. I am using a BR for this purpose.
(function executeRule(current, previous /*null when async*/) {
var callerName = current.caller_id.getDisplayValue();
var assignedTo = current.assigned_to.getDisplayValue();
var comments = current.comments;
gs.addInfoMessage("COMMENTS: " + comments);
// Get the autoclose time period
var autoCloseTime = gs.getProperty('glide.ui.autoclose.time');
// Build the message with placeholders
if (current.caller_id == current.resolved_by) {
current.setMandatory('assigned_to', false);
if (!comments) {
// Display a message to prompt the caller to enter a comment
gs.addErrorMessage("Please enter a comment before resolving the incident.");
current.setAbortAction(true); // Set the state back to its previous value
} else {
var workNotesMessage = "Hi " + assignedTo + "," + "\n\n" +
"This Incident is resolved and doesn't require further attention.\n";
}
} else {
var workNotesMessage = "Hi " + callerName + "," + "\n\n" +
"Your incident has been resolved.\n\n" +
"Summary details:\n" +
"Resolved by: " + gs.getUserDisplayName() + "\n" +
"Resolution code: " + current.close_code + "\n" +
"Resolved notes: \n" + current.close_notes.getDisplayValue() + "\n\n" +
"The incident will automatically close in " + autoCloseTime + " days" + "\n\n" +
"You can either reopen or close the incident using the Actions button.";
// Set the updated work_notes field
if(!assignedTo) {
gs.addErrorMessage("Assigned to field is mandatory");
current.setAbortAction(true);
} else {
current.comments = workNotesMessage;
}
}
})(current, previous);
However, it is unable to capture the comment filed. How do I do this?
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 12:35 AM
*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************