You need to sign in to do that
Don't have an account?

Before Insert Trigger error
I am using the following code for before insert trigger for a custom object Position__c.
When I try to save get an error. Error message is as follows:
Line 4: Invalid field working_on__c for sObject Position__c.
******** Trigger code on developer **********
trigger Trg1 on Position__c (before insert) {
for(Position__c t : Trigger.new){
if(t.working_on__c==t.Hiring_Manager__c){
t.working_on__c.adderror ('Data in name and Working fields should be different');
}
}
}
***********
Please let me know what is wrong.
Thanks,
MS
When I try to save get an error. Error message is as follows:
Line 4: Invalid field working_on__c for sObject Position__c.
******** Trigger code on developer **********
trigger Trg1 on Position__c (before insert) {
for(Position__c t : Trigger.new){
if(t.working_on__c==t.Hiring_Manager__c){
t.working_on__c.adderror ('Data in name and Working fields should be different');
}
}
}
***********
Please let me know what is wrong.
Thanks,
MS
I believe that error is only given if the associated object has no field named 'working_on__c'. Did you double check the API name for that field? You should be able to check by going to Setup | Create | Objects. Click on the Position object and look at the Custom Fields & Relationships related list to see if you got the full API name.