0

I am encountering an issue with running my test class as a made-up user. It seems like I have insufficient access to uploading files onto the org, anyone would be able to point me in the right direction? The profile has a Customer Portal license I already tried enabling the Select Files from Salesforce on the profile system permissions I already tried allowing guest access to upload files

error log

2
  • are you using criteria-based sharing to grant access to the Customer Portal user (in PROD)? Criter-based sharing isn't honored in apex testmethods. There are workarounds
    – cropredy
    Apr 21 at 16:56
  • I actually fixed it, I was had another id that was hardcoded on the main class, just had to pass in a parameter to make sure that the id gets properly changed on the main function too.
    – Bartek
    Apr 21 at 20:49
1

You have multiple types of error there.

DUPLICATE_VALUE is an error on inserting a Hierarchy Custom Setting that already exists.

INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY is an error that can be generated by a myriad of different issues. In this case, my first guess is that the running user does not have access to the record to which you are seeking to attach the file.

3
  • Hi David, Concerning the insufficient ability to attach the file, do you know what I could do to fix this, I tried the things mentioned above but no luck with allowing that user to attach the file.
    – Bartek
    Apr 21 at 16:13
  • Without more detail on the scenario, I have no idea. You should look closely at record-level access in your test setup for the record to which you are trying to attach the file.
    – David Reed
    Apr 21 at 16:19
  • I actually fixed it, I was had another id that was hardcoded on the main class, just had to pass in a parameter to make sure that the id gets properly changed on the main function too.
    – Bartek
    Apr 21 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.