You need to sign in to do that
Don't have an account?
Sukhdeep Singh
Getting "Too many SOQL queries" Exception in trigger
Hi,
I need to check the "Assign using active assignment rule" check box field & change status to 'open' at Lead update But getting error "System.LimitException: Too many SOQL queries: 101"
Please suggest,
Thanks,
The code is below
trigger AssignLeadFromTimeOutQ on Lead (after update) {
List<Lead> ls = new List<Lead>();
Lead tempLead = Trigger.new[0];
if (tempLead.OwnerId == '00P40000001l62pEAA' && UserInfo.getUserId() == '00570000001PNMtAAO') {
ls.add(new Lead(id = tempLead.id, status = 'Open'));
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule = true;
Database.update(ls, dmo);
}
}
I need to check the "Assign using active assignment rule" check box field & change status to 'open' at Lead update But getting error "System.LimitException: Too many SOQL queries: 101"
Please suggest,
Thanks,
The code is below
trigger AssignLeadFromTimeOutQ on Lead (after update) {
List<Lead> ls = new List<Lead>();
Lead tempLead = Trigger.new[0];
if (tempLead.OwnerId == '00P40000001l62pEAA' && UserInfo.getUserId() == '00570000001PNMtAAO') {
ls.add(new Lead(id = tempLead.id, status = 'Open'));
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule = true;
Database.update(ls, dmo);
}
}
Try below code
Also refre the below links
http://salesforce.stackexchange.com/questions/13651/lead-assignment-rule-in-a-trigger
https://developer.salesforce.com/forums/ForumsMain?id=906F00000008saZIAQ
https://developer.salesforce.com/forums/ForumsMain?id=906F00000008yEWIAY
Regards,
Bhanu Mahesh
Mark it as "SOLVED" if your query is answered
Hi Bhanu,
Thanks for your reply, I tried the code but still getting the same error.
Thanks,