Oscar Lopez
Mega Guru
Mega Guru

I've developed a very friendly widget to share articles with other users from the platform. It works in the Portal as well as in the UI/Console

 

find_real_file.png

[Portal View]

 

Features:

  1. Copy the article's URL
  2. Choose multiple users from [sys_user] table
  3. Delete users from the bucket list
  4. May include a custom message (this is simple plain text)
  5. Can select to share Portal or UI/Console URL (this requires to be tweak if your Portal is different than "sp") 
  6. IT sends an email notification to the users selected

 

Technical Specifications:

  • Widget [Share Article]: Portal widget using Angular and sn-record-picker. This widget must be added to the kb_article page in the Portal.
  • UI Page [shareArticle]: UI/Console widget using Angular and and sn-record-picker. The widget becomes visible by clicking a button on the toolbar of the article displayed.
  • Script Include [shareArticleUtilClient]: Created a record in the [u_share_article] table in order to trigger the email notification with all the information required.
  • Table [u_share_artcile]: Records all the information needed to be send via email. I did not find any other way to send email without a table.
  • UI Script [KBViewArticle]: I've modified lines of code to add the event "shareArticleHandler" that opens the GlideOverlay dialog.
  • UI Macro [kb_view_common_header_toolbar]: I've modified this to include a "Share Article" button.

 

find_real_file.png

[Console View]

Leave your comments and feedback.

 

 

 

Comments
DChandlerKy
Tera Guru

Looks amazing! I'm planning to add it to our dev box next week to play with this as this is something we've been talking about this week actually. Thank you!!! 

Oscar Lopez
Mega Guru
Mega Guru

I've included the second update set with the images used by the Widget.

yundlu316
Kilo Guru

Hi Oscar, I've uploaded your update sets and it works on the platform, but when I try to pull the widget onto the kb_article page so it works in Portal, it won't let me.  Any idea why this is happening?

Paul Curwen
Giga Sage

Just drag the widget into the container\row\column where you want it in page designer. Then preview the page it will be there. If you inspect the page using the page editor you will see it:

 

find_real_file.png

 

 

Paul Curwen
Giga Sage

Hi Oscar,

 

Love it. 

 

Only thing I found is that the widget option title is missing from the widget. Easy added though.

 

Thanks

Felipe17
Giga Guru

Hi Oscar,
thank you for this. Currently, I am trying to include this widget. How is it exactly done? I am struggling to include it to the kb_article page.

Regards,

Felipe

Oscar Lopez
Mega Guru
Mega Guru

Try deploying the update sets attached to this article into your instance.

Then using the page designer in the SNOW Portal open the page "kb_article", on the widgets area on the left search for the new widget "Share Article", then drag and drop it into the right row/frame of the page to include it.

Please mark this article helpful if you find it useful

kc1959
Tera Contributor

Hi Oscar,

It's very kind of you to share this with us.

Can I just ask why the 'Share link' field is editable and has the 'Copy' button available?

I would have thought that the URL would be populated (and read only) when the modal is generated after clicking the 'Share Article' button.

Is this so that the link can be copied and pasted into another email client for recipients that aren't part of the organisation?

Many thanks.

 

 

Oscar Lopez
Mega Guru
Mega Guru

The Share Link should not be editable but selectable.

The Copy button is there for cases where you want to copy and paste it using your own mailbox to send it.

If you click the Share button, a system email notification is sent automatically to the recipients selected in the "Add User" pickup list.

 

Cheers,

Oscar

kc1959
Tera Contributor

Many thanks for the quick reply Oscar.

Our only concern is the need for a custom table as it will come at a cost nowadays but I guess that'll be the budget holder's decision. 

Oscar Lopez
Mega Guru
Mega Guru

Totally agree with you, when I built this we didn't have such restrictions in previous releases.

I haven't seen any API to send email from ServiceNow via script; email notifications are always linked to a specific table this is why a created a custom table.

 

Workaround:

Be creative and leverage an existing table to send the notification, add the fields of the custom table into the existing table and build a specific condition to trigger the notification only when it's about sharing an article then you won't be charged extra $

You don't need to keep track of share link notifications records, so maybe an Event or ECC queue tables could do the work. Think it about it and let me know what solution you end up implementing.

 

Cheers,

Oscar

Felipe17
Giga Guru

I am trying to include your update set with the page designer, but I doesn’t work.

 

Here are my steps:

 

  1. Download your two update, import them, preview and commit
  2. Go to Service Portal Configuration > Designer > Filter by “kb_article” > select “kb_article” page (not “kb_article_view” page)
  3. Filter Widget > Select “Share Article” and drag and drop it to the right side.

a) Is this correct place ?

find_real_file.png
b) Nevertheless, it is visible in the page definition, but in the portal, it is not

What am I doing wrong 😄

 

Oscar Lopez
Mega Guru
Mega Guru

Hi Felipe,

I tried the same thing and found same issue as you. When I drag the widget it doesn't stay and entire page is reloaded, even I got a message that the widget is part of Global scope application.

My best guess here is that now KBM is now a scoped app (Knowledge Management - Service Portal), this means that the updates I've provided will not work in most current releases.

However you could just create a new update set in the right Application Scope, create all the artifacts I have in the update set within the scope app and also make sure that you include the new Widget in the kb_article_view page in the Page Designer.

This should fix the issue.

Once I have more time I'll fix this entire article or create a new one.

Oscar Lopez
Mega Guru
Mega Guru

Hi Community,

 

I've release a new version for Share Article, this new version is compatible with Orlando and Paris; I've also posted a video to demonstrate the widget and how to install it in the Service Portal

Share Article Widget v2

Enjoy!!

Oscar Lopez

Felipe17
Giga Guru

Fantastic 🙂

Sandeep85
Tera Contributor

Hi All, we created the same thing but we added two radio buttons . 1)share as link 2)share as pdf 

ex: when we select shae as pdf radio button, knowledge article pdf will trigger via email.

 

Please help me on this  @Oscar Lopez @Chuck Tomasi @Ankur Bawiskar @Tim Davis 

Version history
Last update:
‎07-20-2018 10:49 AM
Updated by: