- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2018 02:49 PM
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:
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2018 11:11 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2018 03:28 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2018 03:35 PM
I deactivated the business rule and I was able to close the task without the attachment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2018 03:42 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2018 03:52 PM