You need to sign in to do that
Don't have an account?
Gavin Britto
field update trigger
To give you some background, I have a parent object called Concept_Master_Contact__c and child object called Concept_Email__c
I am trying to write a tirgger that would update the Unique_person ID on Concept_Email__c when it is changed in Concept_Master_Contact__c
Any help with fixing the trigger below will be appreciated.
Problem: initial term of field expression must be a concrete sobject: List<Concept_Master_Contact>
trigger updateFields on Concept_Email__c (before update) {
//The parent Object
List<Concept_Master_Contact__c> conmast = new List<Concept_Master_Contact__c>();
//The child object
public List<Concept_Email__c> conemail{get;set;}
for (Concept_Email__c obj: trigger.new){
//if the Unique person ID changes on the parent object, change the person ID on the child object to match the parent object
If (conemail.Unique_Person_ID__c != conmast.Unique_Person_ID__c){
conmast.Unique_Person_ID__c = conemail.Unique_Person_ID__c;
}
}
}
I am trying to write a tirgger that would update the Unique_person ID on Concept_Email__c when it is changed in Concept_Master_Contact__c
Any help with fixing the trigger below will be appreciated.
Problem: initial term of field expression must be a concrete sobject: List<Concept_Master_Contact>
trigger updateFields on Concept_Email__c (before update) {
//The parent Object
List<Concept_Master_Contact__c> conmast = new List<Concept_Master_Contact__c>();
//The child object
public List<Concept_Email__c> conemail{get;set;}
for (Concept_Email__c obj: trigger.new){
//if the Unique person ID changes on the parent object, change the person ID on the child object to match the parent object
If (conemail.Unique_Person_ID__c != conmast.Unique_Person_ID__c){
conmast.Unique_Person_ID__c = conemail.Unique_Person_ID__c;
}
}
}
parentIds.add(emailRecord.Contact__c);
It should be working now.
Please let me know if this helps.
If yes, please mark the Question as Solved.
Thanks and Regards,
Anirudh Singh
All Answers
There are a few mistakes in the Trigger. I have re-written it and explained the code. I hope it helps.
Important: Please change FieldAPINameForParent__c accordingly.
The FieldAPINameForParent__c should be the API Name of the field on Concept_Email__c object linking to the Parent Concept_Master_Contact__c
Please let me know if this helps.
If yes, please mark the Question as Solved.
Thanks and Regards,
Anirudh Singh
Hi Anirudh,
Thank you so much for the detailed explanation and the help you've provided. I understand the explanation well. Only challenge I am running into is that line 11:
parentIds.(emailRecord.Contact__c);
has a Method does not exist or incorrect signature: [Set<Id>].(Id)
Any idea on how to get around this?
parentIds.add(emailRecord.Contact__c);
It should be working now.
Please let me know if this helps.
If yes, please mark the Question as Solved.
Thanks and Regards,
Anirudh Singh