- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2017 12:34 PM
Instead of:
attachment.addQuery('table_sys_id','sys_id');
could you please try with:
attachment.addQuery('table_sys_id',sys_id);
Also, please check this thread: Catalog service making Mandatory Attachment both application and SP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2017 01:37 PM
Hi Rafael,
I tried it and it didn't make a difference. Should I be including a script in the catalog task as well?
Thanks,
Grace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2017 09:11 PM
Hi Grace,
An update on my existing post, you can use Glide Aggregate on Server side which is a Best Practice for better System Performance rather than using Glide Record on Client Side. Write an Before Insert/Update Business Rule on Catalog Task Table as below:
Condition: You can specify the Catalog Item for which you want to configure this validation by dot walking as mentioned below:
Select "Show Related Fields" option from the filter condition first and then dot walking as "Request Item-->Requested Item fields"
Post which you can select the field as "item" is "Your Item Name" as shown below:
Script:
(function executeRule(current, previous /*null when async*/) {
var att = new GlideAggregate('sys_attachment');
att.addAggregate('COUNT');
att.addQuery('table_name', current.getTableName());
att.addQuery('table_sys_id', current.sys_id);
att.query();
var count = 0;
if (att.next()) {
count = att.getAggregate('COUNT');
if (count<1) {
gs.addInfoMessage("Please attach Attachment");
current.setAbortAction(true);
}
}
})(current, previous);
Hope this helps.Mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2017 10:15 AM
This worked, thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2020 03:54 PM
This is fine but even though it doesn't let the user insert a record without attachment. It still occupies the next number sequence on the table. for example in your example SCTASK000 number is taken even though record was rejected