I want an SS2 service to save a file to the file c...
# suitecommerce
c
I want an SS2 service to save a file to the file cabinet from an attachment the user puts on a form I created. - SCMA runs as a copy of the customer center role which cannot save files to the fial cabinet. I see two options: 1. Modify the permissions of the service to allow saving to the file cabinet 2. Save the attachment as base64 into a custom record then use another script to create the file. The second is a pain, is the first possible?
s
It used to be possible to store files in the file cabinet but recently with the latest update on NetSuite post operations with the multipart/form-data content type have been throwing errors, I have raised a support case but if you're experiencing the same problems it would if we all raise cases. I don't think it is a problem on your roles and permissions, something is broken on NS.
c
I just get a permissions error.
s
What permission did you set?
c
You can't set any new permissions.
Can you?
"type":"error.SuiteScriptError","name":"INSUFFICIENT_PERMISSION","message":"Permission Violation: You need  the 'Lists -> Documents and Files' permission to access this page. Please contact your account administrator.","id"
Impossible to add new permissions to customer center roles.
s
I have set that permission using elevated permissions on the service file, but after you might face the issue I was commenting
c
How can I find the service file?
s
image.png
c
I found this but I can't change anything
s
I'm assuming that you know the service name, since it should be custom, you can search for it on the global search or navigate through the folder you see there as Application Folder
c
Many results!
I guess that's one for each version of the extension - I can find the latest one, but that's just a file. Can I set permissions from there?
s
yes, after identifying the correct file you can go to the permission tab and set it to run with a different role than the user's role
c
Looks like I need a create a role for this
Thanks, this looks promising!
s
I hope you don't run in the same issue than I do which is even after setting the right permission the service will throw an exception with a 200 status code 🤷
c
I'll let you know shortly
s
ty!
c
I assume I don't need to re-deploy anything?
I got the same perms error, maybe I didn't select the correct service version.
s
it could be that or that you didn't mark the other checkboxes, this is the way we have set it up that is used to work
c
You didn't set any external roles?
Confirmed the correct file, still getting the same perms error
Role
e
@Craig if you have some working code, I would move the logic to a suitelet that runs as Administrator and call the suitelet from your SS2 service, that should work.
s
the service file that you should be modifying is the one where the path starts with something like this: "Web Site Hosting Files : Live Hosting Files : SSP Applications : NetSuite Inc. - SCA 2023.2.0 : Development2 : extensions..." not the one within the SuiteScripts : Deploy_Extensions folder
c
I went down the Suitelet route as it's just easier and less of an unknown Thanks @eminero and @Sebastian Alexis Gonzalez
c
If you try/catch and log the backend error, you should be able to see which permission is missing.