Create a client script to add attachment in requested item.

FaizDev101
Tera Expert

Created a variable named attachment for catalog item ,

The requirement is

when submit the form the attachment should create a record in "sys_attachment" table with

table_sys_id as sys_id of the current requested item, and table name as 'sc_req_item' .

Implement it through a simple onSubmit catalog client script in servicenow.

4 REPLIES 4

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

How is this different than adding an attachment directly through a Catalog Item? Or an attachment through a variable of type attachment?

 

Why would you need a client script for this?

 

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Adding an attachment directly through catalog item is possible but, as per my requirement the attachment field is mandatory and the default attachment is not showing in the related information widget in service portal, but the variable attachment is showing in related information. Help me with a catalog client script for the requirement.

 

Kind regards,
Faiz

So you could also use the Mandatory attachment checkbox on the Catalog Item then?

 

Or I'm just not understanding your question.

 

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

I need to show the attachment in related information widget in service portal when it is empty like other variables but, it is not possible with the default attachment, so i created a variable for attachment.

 

Kind regards,
Faiz