You need to sign in to do that
Don't have an account?
manhnt.bkit
[issue] Change Lead owner trigger before insert
Hello everyone,
I have a trigger change owner before insert a new lead record.
trigger trickOnLead on Lead (before insert) {
for (Lead ld : Trigger.new) {
if(ld.testId__c != null ){
ld.ownerid = ld.testId__c;
}
}
}
-------------
I tested it through web-to-lead, and its successful.(on Monday, July 8th),
but today its not work anymore ?!
note that it only work for manual create a new record.
Thanks,
Manh
Thanks Souvik !
actually I have test the value of " testId__c" in trigger by put it in email (for test).
Finally I came up with this code.
trigger trickOnLead on Lead (before insert, before update) {
for (Lead ld : Trigger.new) {
if(ld.testId__c != null ){
ld.ownerid = ld.testId__c;
}
}
}
All Answers
I didn't find any problem in the trigger. Make sure you have value in this field testId__c.
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
Thanks Souvik !
actually I have test the value of " testId__c" in trigger by put it in email (for test).
Finally I came up with this code.
trigger trickOnLead on Lead (before insert, before update) {
for (Lead ld : Trigger.new) {
if(ld.testId__c != null ){
ld.ownerid = ld.testId__c;
}
}
}