You need to sign in to do that
Don't have an account?
Cynthia Rodgers 12
I need assistance with a trigger that has field update.
I am using a standard object and custom object thats related. I am trying to solve for the following: When LLC_BI_Status__c = Complete, update the Opportunity stage (stagename) to "Won". Object Names; Product Package (API= Product_Package). Status (LLC_BI_Status__c) and Opportunitites (Stagename)
I haven't compiled this and I assumed the custom object is Product_Package.
I updated the query a bit and this is what I have so far Trigger OppUpdate on Opportunity(after insert, after update){
//To store the list of opportunities that needs to be updated.
Set<ID> OppIds = new Set<ID>();
//Get the List of Opportunities for which the related object has the status set to Complete.
for(Opportunity Name = Trigger.new;;
)if(prodPkg.LLC_BI__Status__C == 'Complete') {
OppIds.add(prodPkg.Name);
}
}
List<Opportunity> oppLst = new List<Opportunity>();
//Query the list of opportunities and update the stageName and update.
for(Opportunity oppToUpd : [SELECT Id, StageName FROM Opportunity WHERE id in :OppIds])
{
oppToUpd.StageName = 'Won';
oppLst.add(oppToUpd);
}
update oppLst;
}
Or is there a custom field in Opportunity based on which you wanted to updated the StageName. plz confirm.
The below line of code has to be updated based on the API field name used for the relation between PRODUCT_PACKAGE & Opportunity,
OppIds.add(prodPkg.Opportunity__C); -- replace Opportunity__C with the API field name.