- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 02:44 PM
Hi - The requirement is I need to show a UI button named "Email Article" on the knowledge article when there are PDF attachment attached to the article.
Here is the script include and the UI action. The email client pop up is working but looks like the script include is not called. What is that I am doing wrong?
Script Include:
var checkAttachments = Class.create();
checkAttachments.prototype = Object.extendsObject(AbstractAjaxProcessor, {
initialize: function() {},
checkAttachment: function(kbID) {
//var kbID = this.getParameter('sysparm_kbID');
var att = new GlideRecord("sys_attachment");
att.addQuery("table_name", "kb_knowledge");
att.addQuery('table_sys_id', kbID);
att.addEncodedQuery('content_typeLIKEpdf');
att.query();
if (!att.next()) {
return false;
}
return true;
},
type: 'checkAttachments'
});
UI Action:
function runClientSideCode()
{
emailClientOpenPop('kb_knowledge', false, null, null, '24d933141be4421038bfc88c0a4bcb39');
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 03:10 PM
Hi, what are the results of your debugging\diagnostics? Does your condition script run, are the conditions met?
is Boolean true returned to the condition check? Is your client side code triggered?
From a quick check I suspect your condition syntax may be incorrect as the script-include call is missing ()
new global.checkAttachments().checkAttachment(current.sys_id) == true;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 03:10 PM
Hi, what are the results of your debugging\diagnostics? Does your condition script run, are the conditions met?
is Boolean true returned to the condition check? Is your client side code triggered?
From a quick check I suspect your condition syntax may be incorrect as the script-include call is missing ()
new global.checkAttachments().checkAttachment(current.sys_id) == true;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 03:24 PM
Thank you so much! It was the () parenthesis that was missing. Lit things make a huge difference 🙂