Attachment Widget not working for Record Producers in Service Portal

abhi_29
Tera Expert

Hi there,

I have cloned the OOB SC Catalog Item Deprecated widget and using it to show a record producers in portal. So far its working fine. But the "Add Attachments" section of the widget is not working. Whenever I am trying to attach any files the file selector is opening up but no file is getting attached. And also I am getting an error in the console as below:

find_real_file.png

Do I need to change something for record producers ? I have tried it with catalog item and its working fine there. Thanks in advance.

1 ACCEPTED SOLUTION

Okay, so after further analysis got to know that this error was caused by another widget client controller. I was actually clearing the angular headers to overcome pre-flight response error (CORS) in another widget. Seems like whenever I upload any attachments, there is a REST API call to the attachments table and without the X-User token in the angular header it was throwing me 401 unauthorized error. I have passed the session id as X-User token in the angular header and the issue is solved now. Thanks for the help! 

View solution in original post

4 REPLIES 4

Harish KM
Kilo Patron

Why are you using Deprecated  widget? You can use clone the new one which is not Deprecated . ?Deprecated  means servicenow has made some changes to the new SC cat item widget

True, but its not related to the attachment functionality because its working for other catalog items. I have also tried with the new widget (SC Catalog Item) but still no luck. This issue is only happening for record producers. Its working fine for catalog items. Do I need to make some changes for scoped application as my record producers belongs to a scoped app.

I havent faced any issues. I do have record producer used for scoped apps.

i have attached the xml of my attachment widget have a look

 

Okay, so after further analysis got to know that this error was caused by another widget client controller. I was actually clearing the angular headers to overcome pre-flight response error (CORS) in another widget. Seems like whenever I upload any attachments, there is a REST API call to the attachments table and without the X-User token in the angular header it was throwing me 401 unauthorized error. I have passed the session id as X-User token in the angular header and the issue is solved now. Thanks for the help!