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

Pratiksha Kalam
Kilo Sage

Hello,

Just wanted know why Onload() check box is uncheck?

 

Thanks,

Pratiksha

Hi Partiksha,

 Thanks for your  suggestion, I will try checking that option, let you know, Thanks

rahulyamgar
Tera Guru

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

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.