- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2016 02:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2016 11:21 PM
Hi Soumen,
No need to create a separate business rule for this.
Just query to sys_attachment table.
Please try below client script.
var sysid = g_form.getUniqueValue();
var attach = new GlideRecord('sys_attachment');
attach.addQuery('table_sys_id',sysid);
attach.query();
if(attach.next()){
alert("form contains attachment");
}
Please mark it as Helpful/Correct according to its impact.
Thanks,
Mihir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2016 11:12 PM
Business Rule
-------------------------
When - Display
Query - true
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
g_scratchpad.hasAttachments = current.hasAttachments();
gs.addInfoMessage("g_scratchpad.hasAttachments"+g_scratchpad.hasAttachments);
})(current, previous);
Client script
---------------------------------
type :Onload
function onLoad() {
//Type appropriate comment here, and begin script below
alert('g_scratchpad.hasAttachments : '+g_scratchpad.hasAttachments);
}
This is working fine.See the attached screenshot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2016 11:21 PM
Hi Soumen,
No need to create a separate business rule for this.
Just query to sys_attachment table.
Please try below client script.
var sysid = g_form.getUniqueValue();
var attach = new GlideRecord('sys_attachment');
attach.addQuery('table_sys_id',sysid);
attach.query();
if(attach.next()){
alert("form contains attachment");
}
Please mark it as Helpful/Correct according to its impact.
Thanks,
Mihir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2016 03:29 AM
Hi Mihir,
I have used your code and this is working fine.
thank u
Soumen

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2016 03:33 AM
Hi Soumen,
FYI .. as per best practice don't write Gliderecord on client side, call includescript for that .
Regards,
Harish Murikinati.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2016 03:44 AM
Hi Soumen,
Glad to hear that it works for you.
Please mark my solution as correct for reference of other users.
Thanks,
Mihir