- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 07:43 PM
Hi All,
I have a requirement to validate the attachment name for a certain type of ctask. I have written a BR on attachment table, script is working fine but this validation is working on all ctask that we don't want. I know that the dot walking with table name won't work. Please tell me if we can put this advance condition and how.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 08:21 PM
Hi @Shubham67 the query is wrong in line 51,
it must be
gr.addEncodedQuery('change_task_type=ci_load^sys_id='+current.table_sys_id); //used for encoded queries
not
gr.addActiveQuery(); .//this is used to filter active records
similar to
gr.addQuery('active',true);
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 07:54 PM - edited 02-01-2024 07:54 PM
Hi @Shubham67 you can write advanced script on attachment table and validate with sysid of that record
example:
var gr = new GlideRecord("tablename");
gr.addQuery("sys_id", current.table_sys_id);// match table sysid with record sys id of that table
gr.addQuery('short_description', 'this is test');// retrieve record matches short desc = this is test // addtional query
if (gr.next()) {
// validation here
}
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 08:18 PM
Hi Harish,
I have this condition in the script.
But it is applying to all ctasks. Please suggest something that we can apply on condition of BR.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 08:21 PM
Hi @Shubham67 the query is wrong in line 51,
it must be
gr.addEncodedQuery('change_task_type=ci_load^sys_id='+current.table_sys_id); //used for encoded queries
not
gr.addActiveQuery(); .//this is used to filter active records
similar to
gr.addQuery('active',true);
Harish