You need to sign in to do that
Don't have an account?
Michael Webb
Trigger not working.. (new to dev)
I have a trigger all I want to do is make field a equal to field b when the document is saved. The first feild (name) which is the standard feild is a required field. When I try to save this it says needs = in line 2 column 30. I dont know what I am doing wrong. Thank you for your help!
Trigger updateFields on McLabs2__Property__c (before update) {
for (McLabs2__Property__c : trigger.new){
Name = McLabs2__Property_Address__c;
}
}
Trigger updateFields on McLabs2__Property__c (before update) {
for (McLabs2__Property__c : trigger.new){
Name = McLabs2__Property_Address__c;
}
}
Please Refer below code:
If this solves your problem, kindly mark it as the best answer.
Thanks,
Vatsal
All Answers
Trigger updateFields on McLabs2__Property__c (before update) {
for (McLabs2__Property__c a: trigger.new){
a.Name = a.McLabs2_Property_Address__c;
}
}
Please Refer below code:
If this solves your problem, kindly mark it as the best answer.
Thanks,
Vatsal
I missed 'd' in oldMap.
Replace it with below line:
McLabs2__Property__c property = Trigger.oldMap.get(a.Id);
That worked if I broke it up into 2 triggers, kept telling me I had a duplicate variable, I will continue to work on that error and try to get them both in the dame trigger. One Question though, Name is a required field, is there any way to populate Name when I hit save? It makes me enter something into the Name field then when I save the trigger changes it to what was in the address field (which is correct) I just want that field to be populated so I don''t get the error that it is a requried feild.
Thank you, I will mark yours as the best answer.