We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Manage attachments on public record producer in Service Portal

gauravshurvir
Giga Contributor

Hi,

I have created a record producer to capture some information from the user who does not have any role on the instance. It is available for the public. I am rendering it through Service Portal. Have also created some widgets on the portal page. Everything is working fine except attachments. User with some role can easily add/remove attachments on the page but when user without any role  (public user) is trying to attach, nothing is happening. In the console i see an error

find_real_file.png

Has anyone encountered this error ? If yes, can you please advise some workaround.

 I am using attachment widget to manage attachments:

 

find_real_file.png

20 REPLIES 20

It worked for me.
I have some questions: I wanted it to accept more file types, so I added more extensions on line number 14 of Client controller like this:

$scope.field.attributes = {
        allowed_extensions: "csv;xlsx;txt"
    };
After adding this, on submitting it started throwing error - "The following fields contain errors: Upload Attachments " (Upload attachments is the name of the variable I used).
Also I tried replacing txt with xlsx and it worked, so can we just mention two file types here or what else we need to modify to achieve this?

@Ashutosh44 I tried the widget without any luck. Did you make any updates to the widget?

Hello Mario, 

I tried the widget created by Krauzi but still having issues with uploading attachments. Did the widget work for you?

Install the following apps:
https://github.com/kr4uzi/ServiceNow-Multipart
https://github.com/kr4uzi/ServiceNow-Public-Catalog-Item-Attachments

Afterwards your Attachment Variables and the Attachment Icon/Button will work for public catalog items / record producers.

Note: While previous solution (posted on my [no longer used] business account) was bypassing ACLs, the new solution doesn't. This means that you need to have a public create ACL on sys_attachment.

Hello Markus,

 

You've done an amazing job!

I installed the applications however I'm not able to make it work. When I attempt to add an attachment the browser console logs a "500 Internal Server Error" and the system logs show "Cannot convert null to an object. (sys_script_include.c265c47193f38250e02873718bba107c.script ➚ ➚; line 35): com.glide.rest.domain.ServiceException: TypeError: Cannot convert null to an object. (sys_script_include.c265c47193f38250e02873718bba107c.script ➚ ➚; line 35):"

 

I've tracked this down to the buffered stream returned by the StreamExt being null.

 

 

Could you please advise what I might be missing?

 

Thank you!