You need to sign in to do that
Don't have an account?
sd2008
A Trigger PrePopulate field question?
I have a trigger which prepopulate a filed before insert, but it does not work.
trigger GetLastAssocID on Obj__c (before insert) {
for (Obj__c ori: System.Trigger.New){
if (ori.ObjName__c == ''){
ori.Obj_ID__c = [Select Obj_ID__c from
Obj__c
Order by Obj_ID__c Desc
Limit 1];
}
}
}
Obj__c is an object I created and Obj_ID is a number(Double) field.
A few things:
if( ori.ObjName__c == null || ori.ObjName__c.equals( '' ) ) { ... }
Hope this helps!
All Answers
A few things:
if( ori.ObjName__c == null || ori.ObjName__c.equals( '' ) ) { ... }
Hope this helps!