The CreatorCon Call for Content is officially open! Get started here.

Service Portal - Custom Attachment Button on Service Catalog

Joey Wan Kenobi
Tera Guru

Does anyone know how to add make a custom attachment button widget work on the service portal for the service catalog?

In Helsinki, this worked fine:

<a href="javascript:void(0)" class="panel-button sp-attachment-add" onclick="jQuery('#attachment_add').click();">

  <span class="glyphicon glyphicon-paperclip"></span>

</a>

In Jakarta patch 6, the button no longer responds (it does nothing). Can anyone help?

1 ACCEPTED SOLUTION

nathanfirth
Tera Guru

Check out the widget I've posted on ServicePortal.io, there I have an example of a custom widget that triggers the attachment.



https://serviceportal.io/downloads/require-attachments/


View solution in original post

20 REPLIES 20

darlawolf
Giga Expert

Reference: Service Portal and client scripts


The following globals and APIs are unavailable in client scripts and catalog client scripts used in the Service Portal:


  • window
  • document
  • $
  • jQuery
  • $$
  • $j
  • angular


Out of the box, there is an attachment icon already on the Catalog item widget. Are you trying to add the attachment icon somewhere else?


find_real_file.png


Yes. It would be a button that does the same thing.... don't ask.


You'll need to create an attachment widget and embed it as a macro variable on your catalog item.


I understand this. This is how it is currently set up. However, the existing code is not working. My question is: how can I make it work?