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

ARG645
Tera Guru

DeActivate the Business rule and try reproducing the problem. This way we will know if Business Rule is the culprit or if its the UI action. 
Once we find the culprit, we can further debug. 

I deactivated the business rule and I was able to close the task without the attachment.

Cool, so now we know Business Rule is the culprit. 

If business rule is executing then it means the conditions in Business Rule are getting satisfied. 

-Please post a screen shot of your UI Action Code

-Please post a screen shot of your Business Rule Conditions part only.

 

Lets see what we got.

For the UI Action Code, you mean the one for close task?

Business Rule Conditions (warning: pretty long because it applies to multiple catalog items):
find_real_file.png

find_real_file.png

find_real_file.png