Scheduled Job Error calling context method: insufficient rights to use table

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Feb 9, 2016
Company: CTC

Hi,

I created a scheduled job, assigned a method to run. Once run, I can see in the events log that it had execution error:
{CommonModule.MyModule.Module(31)}: Error calling context method (Execute)
reason: Insufficient rights to use table "Document.MyDocument"

Know that, in the method I'm running a query accessing myDocument and perform some updates.
My question is

what is the default role used by the scheduled tables? where can I grant it access to the documents that it needs to access.

Any help how to fix this issue?

thanks

 
#2
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Feb 9, 2016
Company: CTC

aparently, you need to use:

SetPrivilegedMode ( true );

before code

and

SetPrivilegedMode ( false );

after code, and it will do the trick

 
Subscribe
Be the first to know tips & trick on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.