How to add a "File attachment" type variable in Service Catalog Item?

James100
Kilo Expert

Greetings.

As you know, we can add File Attachment field on a form.

find_real_file.png

Is it possible to add the same to a service catalog item as a variable? I couldn't find the file attachment variable type ..

Thanks.

1 ACCEPTED SOLUTION

RaghavSh
Kilo Patron

Hi,

This can be done through UI macro/ UI Page. There is a article related to this.

refer: https://hi.service-now.com/kb_view.do?sysparm_article=KB0529497 for same.

Pls. mark this correct/helpful, if applicable.

 

Thanks.


Raghav
MVP 2023

View solution in original post

14 REPLIES 14

Hi Raghav,

Actually project is running on Orlando version.

 

for widget I have used the same following one:

I went to Service Portal --> Widgets --> under Body HTML template kept this one. 

<div>
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<button type="button" onclick="saveCatAttachment(gel('sysparm_item_guid').value, 'sc_cart_item')">Add Attachment</button>
</j:jelly>
</div>

 

Thanks,

Koushik

Hi Raghav,

Actually project is running on Orlando version.

 

for widget I have used the same following one:

I went to Service Portal --> Widgets --> under Body HTML template kept this one.

<div>
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<button type="button" onclick="saveCatAttachment(gel('sysparm_item_guid').value, 'sc_cart_item')">Add Attachment</button>
</j:jelly>
</div>

 

Kindly suggest me.

 

 

Thanks,

Koushik

You are writing jelly in widget which is not supported.

Refer: https://community.servicenow.com/community?id=community_article&sys_id=5df1797b1b0c5050fff162c4bd4bcb3f


Raghav
MVP 2023

Megha Padale
Giga Guru

Hi,

When using a UI macro as an item variable, an attachment link in the code works when browsing the item.

  1. Create a UI macro and include add attachment link in the code.

    For example: <?xml version="1.0" encoding="utf-8" ?> <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null"> <b>Use the paperclip</b> <a onclick="saveCatAttachment(gel('sysparm_item_guid').value, 'sc_cart_item')"> <img title="Attachments..." height="16" src="images/icons/attachment.gifx" border="0" width="16"/></a> <b>to attach items to this request.</b> </j:jelly>

  2. Create a variable and set the condition Type is Macro. Use the macro you just created.

  3. Attach the variable to a service catalog item and try the item.

If my answer helped you in any way, mark answer as helpful and correct.

Thanks and regards,

Megha.

Thanks Megha. I'll try this and feedback later.