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
Mit PatelMit Patel 

InboundEmailHandler::handleInboundEmail ( ) is this method Thread Safe?

Hi All,

I am trying to insert lead record through salesforce Email-services
for example class method:

Global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope envelope) {

Lead newLead = new Lead();
newLead.Name ='test';
insert newLead;
system.debug('----newLead----'+newLead);
}

Now,On Lead Object before insert - update trigger will execute.
After finishing trigger lead record should get created but it doesn't create record and doesn't show debug.
When i make trigger In-Active then it's working fine.

Best Answer chosen by Admin (Salesforce Developers) 
Mit PatelMit Patel
Thanks all of you.

i have resolved this.

All Answers

kiranmutturukiranmutturu
so try to find if there is an issue coming in trigger code...?
Mit PatelMit Patel

Thanks kiran.

 

There is no any issue in trigger .

kiranmutturukiranmutturu
is it possible to post the trigger code?
Mit PatelMit Patel

trigger on lead (before insert , before update)

 

for(Lead l : trigger.new)
{
if(trigger.isInsert){

 l.datefield = Date.today ();
}
else
{
  l.datefield = Date.valueOf(l.createdDate.format('yyyy-MM-dd'));
}

Mit PatelMit Patel
Thanks all of you.

i have resolved this.
This was selected as the best answer