Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

As snc_external, Attachment variable not holding the attachment

Michael183
Tera Guru

When I try to submit a catalog item that was built for snc_external, I am able to go over and populate all variables except for the attachment ones.

 

When trying to upload the file , the file name never shows up in the variable as usually it will do

Michael183_0-1738865906735.png
Once I added a file it shows there

Michael183_1-1738865952892.png

 

and I see the temp entry in sys_attachment

Michael183_2-1738865994206.png

 

 

But while doing this as snc_external.... after selecting the file , the variable shows like this

Michael183_3-1738866061049.png

 

Even though a new temp entry was created on sys_attachment.

 

I have already reviewed ACLs on the sys_attachment table and sc_cart_item . I wonder if you have any other ideas.

 

Thanks

 

 

 

 

4 REPLIES 4

Sandeep Rajput
Tera Patron

@Michael183 It seems that your user with snc_external role doesn't have the create ACL permissions on the sys_attachment table. Please create an ACL to address this and your external user will be able to upload the attachments.

Ankur Bawiskar
Tera Patron

@Michael183 

ensure the snc_external user has CREATE ACL on sys_attachment table

Also did you try with that user if they can add file to paper-clip icon and it moves to the target record?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

elemonnier
Tera Expert

Curious if you found a solution to this? I adjusted the create/read ACLs and that enabled attachments to the form but the catalog item attachment variable doesn't seem to work.

elemonnier
Tera Expert

Figured it out. The ACL has a script 

answer = getSCAttachmentCreateAnswer();

function getSCAttachmentCreateAnswer() {
	gs.log(current.table_name);
    if (current.table_name == 'sc_cart_item') {
        var tableSysId = current.table_sys_id;
        var cartItemRecord = new GlideRecord("sc_cart_item");
        cartItemRecord.get(tableSysId);
        if (!cartItemRecord.isValidRecord() || cartItemRecord.canWrite())
            return true;
    }
    return false;
}

The problem lies in current.table_name == 'sc_cart_item'. For inline variable attachments, the 

current.table_name == 'ZZ_YYsc_cart_item'. So do an Insert and Stay on the existing CREATE and READ ACLs and change the table_name to ZZ_YYsc_cart_item.