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

Maala
Kilo Contributor

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

find_real_file.png

find_real_file.png

10 REPLIES 10

Hi Rahul,

 Could you please share your script that you said it is working for you, Thanks

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:

find_real_file.png

Thanks,
Rahul

Hi Rahul,

I could get this working, but at the same time, another UI action is also applied.(showed in Blue test)

find_real_file.png

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

find_real_file.png

Please try adding below condition:

current.sysapproval.category.getValue() != "Storage"

 

Thanks,
Rahul

Hi Rahul,

 It did not work,Thanks for trying to help.