How can we make BR override OOB UI action message?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2023 09:21 AM
Hi All,
I have a requirement to make comments mandatory while approving the approvals for Knowledge Management Module.
For this functionality, we have created a BR which triggers when:-
And this is the script I am using in for setting comments mandatory:-
current.state = 'approved';
if (!gs.nil(current.comments))
current.update();
else {
gs.addErrorMessage(gs.getMessage("Comments are required when approving an approval"));
current.state = 'requested';
current.setAbortAction(true);
action.setRedirectURL(current);
}
And this is working, but we can still see the OOB message alongwith the message I have set when we try to approve without comment from the list view.
How can we override this behaviour?
Can someone please guide me on what steps to take to override this default behavior?
Thanks in Advance!
Gaurangi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2023 10:10 AM
Hi Gaurangi,
Please try using this method
Mark Correct and Helpful if it helps.
***Mark Correct or Helpful if it helps.***
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2023 10:47 AM
Hi Yousaf,
I tried doing this but the message is still showing.
current.state = 'approved';
if (!gs.nil(current.comments))
current.update();
else {
gs.flushMessages();
gs.addErrorMessage(gs.getMessage("Comments are required when approving an approval"));
current.state = 'requested';
current.setAbortAction(true);
action.setRedirectURL(current);
}
Can you please check if I am doing it right?
Thanks,
Gaurangi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2023 10:29 AM
Hi Gaurangi,
Use below script :
current.state = 'approved';
gs.flushMessages();
if (!gs.nil(current.comments))
current.update();
else {
gs.addErrorMessage(gs.getMessage("Comments are required when approving an approval"));
current.state = 'requested';
current.setAbortAction(true);
action.setRedirectURL(current);
}
Mark answer correct if it helped.
Thanks,
Kumud
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2023 10:44 AM
Hi Kumud,
I tried but it didn't work. 😥