I am trying to Make 'Comments' mandatory, when approving , specific item. I created a UI policy similar to the one which is working correctly, to make 'Comments' Mandatory when rejected. the one I created is not working. also it stops the approva

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2020 02:51 PM
I am trying to Make 'Comments' mandatory, when approving , specific item. I created a UI policy similar to the one which is working correctly, to make 'Comments' Mandatory when rejected. the one I created is not working. also it stops with the first approval, not triggering the next approval.
any advice/ help please, Thanks
- Labels:
-
Notifications

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2020 07:28 PM
Hi Rahul,
Could you please share your script that you said it is working for you, Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2020 07:45 PM
There are 2-3 UI actions against the approval table for "Approve" action. As part of troubleshooting i disabled one which does current.update() after setting state to approved. There is another UI action and I updated code as below:
current.state = 'approved';
if(!JSUtil.nil(current.comments)){
current.update();
new ApprovalUserFeedback().approved(current);
}else{
gs.addErrorMessage(gs.getMessage("Comments are required when approving an approval"));
current.state = 'requested';
current.setAbortAction(true);
}
Below is the screenshot after clicking Approve button:
Thanks,
Rahul

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2020 08:22 PM
Hi Rahul,
I could get this working, but at the same time, another UI action is also applied.(showed in Blue test)
The following OOTB UI action is running, which is for all other approvals, so I can not disable this.
I need this 'comments' Mandatory, only for this specific item, so I need a condition to exclude this item from The OOTB UI action
adding && current.****
not sure how to,
any help would be great, Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2020 09:25 PM
Please try adding below condition:
current.sysapproval.category.getValue() != "Storage"
Thanks,
Rahul

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2020 10:28 PM
Hi Rahul,
It did not work,Thanks for trying to help.