Mandatory Attachment on Closed Complete Task

gnunez
Kilo Guru

Hello,

I currently have a business rule in place to make attachments mandatory before a  task is closed. The requirements have changed and we only want it to be mandatory when it is closed complete. If the task is being closed "incompletely" or "skipped", the attachment should not be mandatory.

I already changed one of my conditions, which I changed from State is one of Closed Complete, Closed Incomplete, Closed Skipped to State is not one of Closed Incomplete, Closed Skipped. After the change the attachment is still mandatory, which makes me think it has to do with the Close Task button.

Any assistance with this would be greatly appreciated!

This is what I currently have:

find_real_file.png

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

Pranay Tiwari
Kilo Guru

Hi,

Change the condition,use this condition state is closed complete ,

and follow below code...Before (insert/update) BR

(function executeRule(current, previous /*null when async*/) {

 var gr= new GlideRecord("sys_attachment");
 gr.addQuery("table_sys_id",current.sys_id);
 gr.query();
	
 if (!gr.hasNext()) {
 gs.addErrorMessage("Attachment is required to submit this Request");
 current.setAbortAction(true);
 }
 
 
})(current, previous);

 

it will work perfectly..

 

Mark correct or helpful if it helps you.

 

Warm Regards,

Pranay Tiwari

| www.DxSherpa.com | pranay.tiwari@dxsherpa.com |

View solution in original post

16 REPLIES 16

Finally got it thank you!

Worked right away!!! Thank you!