- 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-26-2016 02:37 AM
Hi Soumen,
You can do this using a scratchpad variable.
create a on display business rule that will setup a scratchpad variable
g_scratchpad.hasAttachments = current.hasAttachments();
Now, use this scratchpad variable in your client script to check whether related record has attachment or not.
if (g_scratchpad.hasAttachments)
// put your code
else
// put your code
-Harsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2016 05:45 AM
when I am using g_scratchpad.hasAttachments in clientscript its displaying 'undefined' so its executing else pert of the code always
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2016 07:17 AM
have you created the business rule . Update the business rule to before query and then try the client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2016 09:33 PM
Hi Harsh,
Yes I have written business rule and Update it before write the client script.the g_scratchpad object is available in client script but it doe not find .hasAttachments .So it becomes undefined.
Thanks,
Soumen