You need to sign in to do that
Don't have an account?
Ramanjot Sidhu
Trigger not working: Expression cannot be assigned at line -1 column -1
trigger ControlOpportunityStage on Line_Item__c (after update) {
List<Opportunity> parentlist = new List<Opportunity>();
List<Opportunity> opportunityId = new list<Opportunity>();
for(Line_item__c lirecord : [SELECT Opportunity__r.id, Opportunity__r.StageName
from Line_item__c
where Line_item__c.Opportunity__c <> null]){
for(Opportunity opt : parentlist)
if(Opportunity.StageName != Line_item__c.Stage__c)
Opportunity.StageName = Line_item__c.Stage__c;
opportunityId.add(opportunity.Id);
{
if(opportunityId != null & opportunityId.Size()>0)
update opportunityId;
}
}
}
List<Opportunity> parentlist = new List<Opportunity>();
List<Opportunity> opportunityId = new list<Opportunity>();
for(Line_item__c lirecord : [SELECT Opportunity__r.id, Opportunity__r.StageName
from Line_item__c
where Line_item__c.Opportunity__c <> null]){
for(Opportunity opt : parentlist)
if(Opportunity.StageName != Line_item__c.Stage__c)
Opportunity.StageName = Line_item__c.Stage__c;
opportunityId.add(opportunity.Id);
{
if(opportunityId != null & opportunityId.Size()>0)
update opportunityId;
}
}
}
you have missed { braces in your trigger code(for(Opportunity opt : parentlist)
if(Opportunity.StageName != Line_item__c.Stage__c)
Opportunity.StageName = Line_item__c.Stage__c;
opportunityId.add(opportunity.Id);
{) and this is main problem. try below corrected code it should work and it should work. not sure what is use of this your code but I removed error. PLease let me if it works.
Best Regards,
-Vivek