Subscribe a customer contact to Knowledge Article using script - is this possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2024 02:05 PM
Hello SN community,
We have a need to subscribe customer contacts to KB articles created off of a case. We already have a UI action in place that creates a KB article from the case record. I was hoping there was a delivered script include that would expose some helpful functionality for this need but the closest I got to anything that approached this was in
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2024 01:30 AM
Hello,
You can update the existing UI Action to add the subscription functionality. Once the KB is inserted via UI Action, store the insert in a variable and start GlideRecord for kb_subscribe with its article as KBsysID, user as customer_contact from Case. Example code looks like below:
//---previous Code till here----
var kbSysId = kbGR.insert();
if (kbSysId) {
var subscriptionGR = new GlideRecord('kb_subscribe');
subscriptionGR.initialize();
subscriptionGR.article = kbSysId;
subscriptionGR.user = caseGR.customer_contact; //caseGR is current as UIAction is on 'sn_customerservice_case'
subscriptionGR.insert(); //Customer contact subscribed to KB article
}
action.setRedirectURL(current); //dont forget to add this incase UIAction clicking person needs Case view
Hope this helps!
Regards, Akash
Please mark it as helpful👍 or Accept Solution✔️ based on answering your query.
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2024 09:13 AM
Hello Akash, thank you for the reply! Unfortunately we do not have the kb_subscribe table in our instances. I'm not able to find documentation for this table, do you have a reference to any docs or developer pages? Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2024 10:38 AM
I haven't worked with the table directly, but I believe you want to use the sn_actsub_subobject_stream table.