1

I have a site page with a form that can be accessed by guest users. I have an upload button that when it's clicked a tracking record is created (it's ok for guest user as the profile has read/create) but when submitting the form I run an upsert over the tracking record, that was causing an exception for the guest user. I tried doing the update on a future method if the user was a guest and it worked. My question is, why if the running context of a future method is the same (guest user) update runs successfully? Is this an expected behavior? Thanks!

2
  • Does your class has with sharing? Oct 12, 2021 at 2:15
  • @MohithShrivastava no, it does not have sharing declaration. But without the future method I receive the error anyway. Oct 12, 2021 at 13:13

1 Answer 1

1

A bit late to the party, but... Any errors occurring in a @future method will not show up in the debug log for this call, as it will run in a new context, generating a new, separate debug log for the same user.

Any errors will show up there.

Bonus: The result of the @future call, plus error status, will be visible in setup, under "Apex Jobs".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .