Skip to main content
added 718 characters in body
Source Link
sdondeti
  • 715
  • 1
  • 11
  • 35

The use case is a trigger calls(enqueues) a Queueable job. The code is failing and I did some debugging and figured out that it is running in user context. I thought asynchronous jobs run in system context. Is it possible to run a Queueable job in system context?

This is my use case

A partner community user creates an account and we need to transfer the ownership to internal user and then grant Read permission to community user who created it. In the Account trigger, I change the owner to internal user but can't insert a row into AccountShare due to the error "INSUFFICIENT_ACCESS_ON_ CROSS_REFERENCE_ENTITY". After debugging, I realized that the community user already has access to account because the record with new owner in not committed yet. So in the trigger I change the ownership and in the queuable job, I am inserting a row into AccountShare for community user but I still get "INSUFFICIENT_ACCESS_ON_ CROSS_REFERENCE_ENTITY" error in the queueable job.

The use case is a trigger calls(enqueues) a Queueable job. The code is failing and I did some debugging and figured out that it is running in user context. I thought asynchronous jobs run in system context. Is it possible to run a Queueable job in system context?

The use case is a trigger calls(enqueues) a Queueable job. The code is failing and I did some debugging and figured out that it is running in user context. I thought asynchronous jobs run in system context. Is it possible to run a Queueable job in system context?

This is my use case

A partner community user creates an account and we need to transfer the ownership to internal user and then grant Read permission to community user who created it. In the Account trigger, I change the owner to internal user but can't insert a row into AccountShare due to the error "INSUFFICIENT_ACCESS_ON_ CROSS_REFERENCE_ENTITY". After debugging, I realized that the community user already has access to account because the record with new owner in not committed yet. So in the trigger I change the ownership and in the queuable job, I am inserting a row into AccountShare for community user but I still get "INSUFFICIENT_ACCESS_ON_ CROSS_REFERENCE_ENTITY" error in the queueable job.

Tweeted twitter.com/StackSalesforce/status/679854541802762240
deleted 33 characters in body; edited title
Source Link
Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431

Run Queueable job runJob in system contextSystem Context?

The use case is a triggertrigger calls(enqueues) a queueableQueueable job. The code is failing and I did some debugging and figured out that it is running in user context. I thought asynchronous jobs run in system context. Is it possible to run a queueable job in system context.

Any insight is appreciated.

Thanks.Is it possible to run a Queueable job in system context?

Queueable job run in system context

The use case is a trigger calls(enqueues) a queueable job. The code is failing and I did some debugging and figured out that it is running in user context. I thought asynchronous jobs run in system context. Is it possible to run a queueable job in system context.

Any insight is appreciated.

Thanks.

Run Queueable Job in System Context?

The use case is a trigger calls(enqueues) a Queueable job. The code is failing and I did some debugging and figured out that it is running in user context. I thought asynchronous jobs run in system context. Is it possible to run a Queueable job in system context?

Source Link
sdondeti
  • 715
  • 1
  • 11
  • 35

Queueable job run in system context

The use case is a trigger calls(enqueues) a queueable job. The code is failing and I did some debugging and figured out that it is running in user context. I thought asynchronous jobs run in system context. Is it possible to run a queueable job in system context.

Any insight is appreciated.

Thanks.