function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LakshmanLakshman 

Outbound Email service context

Hi,

 

Does any one know the context of outbound email service. I am sending Single Email Message from customer portal to portal User's email. I want to update record whose ID is present in the email subject using Email service under some other user context.

 

Also if anyone knows if we can change context of user somehow w/o using scheduler please let me know. 

Thanks!

 

-Lakshman

 

 

bob_buzzardbob_buzzard

I'm not aware of any way to change the user context.  Even things like @future etc know about the user that started it from the underlying trigger etc.

LakshmanLakshman

As in scheduler the the user context is the person who scheduled the Apex, so I am not sure if the same applies for Email Service class, what is the user context of Email Service class, do you know waht would be the user context if I write an outbound email service?

 

-Lakshman

bob_buzzardbob_buzzard

Outbound email is sent from apex by the user that is executing the apex.  Email services are for handling inbound email, so I don't think they come in to your scenario.

LakshmanLakshman

Yes you are right but I will be sending email to the EmailService addess which will be further handled to update object. So my question is what would be context when I receive an Inbound email received via EmailService address.

 

-Lakshman

bob_buzzardbob_buzzard

Ah - I understand.

 

When you set up an email service you configure email addresses associated with it.  The email address record has a context user, and the service assumes the permissions of that user so I'd expect that any changes would be made under the name of that user.

LakshmanLakshman

Alright then I would start developing that Email Service and will hope that it runs in the specified Context User.

 

Thanks for you help Bob!

 

-Lakshman

kibitzerkibitzer

You can specify the user context for an inbound Email service. It's actually a pretty handy way to switch user context.

 

Dan