You need to sign in to do that
Don't have an account?
NewCoderBoy
why do i get this error on a trigger i created
I wrote a trigger on a parent object to update the child object so an email alert does not get sent out. the email alert is on a workflow rule attached to the child object called Lead Source. any help you can provide would be appreciated.
the Parent object is Opportunity and I continue to get this error on line 15:
Illegal assignment from SOBJECT:Opportunity toSOBJECT:Lead_Source__C
here's the code:
trigger FieldVisitComplete on Opportunity (after insert, after update) {
Set <Id> oppIds = new Set<Id>();
for (Opportunity parentObj : Trigger.new)
{
oppIds.add(parentObj.Id);
}
Map<Id, Opportunity> parentObjList = new Map<Id, Opportunity>([Select Initial_Field_Visit_Completed__c FROM Opportunity WHERE ID IN :oppIds]);
for (Opportunity opp : Trigger.new) {
if (opp.Initial_Field_Visit_Completed__c != null) {
Lead_Source__c lsrc = parentObjList.get(opp.Id);
lsrc.Initial_Field_Visit__c = opp.Initial_Field_Visit_Completed__c;
}
}
{
update parentObjList;
}
}
the Parent object is Opportunity and I continue to get this error on line 15:
Illegal assignment from SOBJECT:Opportunity toSOBJECT:Lead_Source__C
here's the code:
trigger FieldVisitComplete on Opportunity (after insert, after update) {
Set <Id> oppIds = new Set<Id>();
for (Opportunity parentObj : Trigger.new)
{
oppIds.add(parentObj.Id);
}
Map<Id, Opportunity> parentObjList = new Map<Id, Opportunity>([Select Initial_Field_Visit_Completed__c FROM Opportunity WHERE ID IN :oppIds]);
for (Opportunity opp : Trigger.new) {
if (opp.Initial_Field_Visit_Completed__c != null) {
Lead_Source__c lsrc = parentObjList.get(opp.Id);
lsrc.Initial_Field_Visit__c = opp.Initial_Field_Visit_Completed__c;
}
}
{
update parentObjList;
}
}
Opportunity Oppty = parentObjList.get(opp.Id);
(or)
Lead_Source__c lsrc = //some lead source record.