3

I have created an cutom lead capture form. I am searching for existing lead or account. If lead or account exists it should get assigned to exhisting lead owner. I am assigning the lead owner through code.

    dmo.EmailHeader.triggerUserEmail = true; 

if(ownerId==null)
{
    leadToCreate.setOptions(dmo);   
}
else
{
    leadToCreate.OwnerId=ownerId;   
}
database.insert(leadToCreate, dmo); 

Here owner gets assigned but after that it is assigned to lead assignment rule.

To avoid assignement rule the I have set

dmo.assignmentRuleHeader.useDefaultRule= false;

`if(ownerId==null)
{
    leadToCreate.setOptions(dmo);   
}
else
{
    leadToCreate.OwnerId=ownerId;  
    dmo.assignmentRuleHeader.useDefaultRule= false; 
}
database.insert(leadToCreate, dmo);`

But problem here is i am not able to get email notification on lead assignement. https://help.salesforce.com/apex/HTViewSolution?id=000003781&language=en_US

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.