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 06:03 PM
Hello,
Just wanted know why Onload() check box is uncheck?
Thanks,
Pratiksha

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2020 07:27 PM
Hi Partiksha,
Thanks for your suggestion, I will try checking that option, let you know, Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2020 06:21 PM
Hello Maala,
You have posted very good question !
For this we need to understand that how are we changing the status of approval, if we are changing the status from the field value, then your UI policy works (I tried it works in my case too). But if you are trying to approve the request from the UI action, then you need to put the code in UI action too. UI action for Approve, updates the state to Approved and issues the current.update() operation which exits from the UI.
For this you could compare the Reject UI Action to achieve the same.
current.state = 'rejected';
if(!JSUtil.nil(current.comments)){
current.update();
new ApprovalUserFeedback().rejected(current);
}else{
gs.addErrorMessage(gs.getMessage("Comments are required when rejecting an approval"));
current.state = 'requested';
current.setAbortAction(true);
}
After modifying, it worked in my instance. Please try and let us know.
Thanks,
Rahul

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2020 07:26 PM
Hi Rahul,
I have tried your suggestion, But there is a OOTB approve UI action, also running. I need to exclude this item from that, by specifying condition , trying , will post my condition, please help me with any correction, Thanks.