You need to sign in to do that
Don't have an account?

Apex Trigger If Statement
I have this trigger and I want to change it to select 1 Gateway ID if the currency of the Opportunity is x and if the Brand on the product is Y ( Through Opportunity Product and Product) or select Gateway 2 if something else etc
trigger UpdateGateway on OpportunityLineItem (after insert, after update) {
Id GatewayId = 'a012000001k5yoK';
Set<id>ids=new set<id>();
list<opportunity> oplst=new list<opportunity>();
For(OpportunityLineItem ol:trigger.new){
if(ol.Continuity__c == True){
ids.add(ol.opportunityid);
}
}
if(!ids.Isempty()){
list<opportunity >opp=[select id,CSFA__Gateway__c from Opportunity where id in:ids];
for(Opportunity op:opp){
op.CSFA__Gateway__c= GatewayId;
oplst.add(op);
}
update oplst;
}
}
trigger UpdateGateway on OpportunityLineItem (after insert, after update) {
Id GatewayId = 'a012000001k5yoK';
Set<id>ids=new set<id>();
list<opportunity> oplst=new list<opportunity>();
For(OpportunityLineItem ol:trigger.new){
if(ol.Continuity__c == True){
ids.add(ol.opportunityid);
}
}
if(!ids.Isempty()){
list<opportunity >opp=[select id,CSFA__Gateway__c from Opportunity where id in:ids];
for(Opportunity op:opp){
op.CSFA__Gateway__c= GatewayId;
oplst.add(op);
}
update oplst;
}
}
Id GatewayId = 'a012000001k5yoK';
Set<id>ids=new set<id>();
list<opportunity> oplst=new list<opportunity>();
For(OpportunityLineItem ol:trigger.new){
if(ol.Continuity__c == True){
ids.add(ol.opportunityid);
}
}
list<opportunity >opp=[select id,CSFA__Gateway__c from Opportunity where id in:ids];
if(!ids.Isempty()){
for(Opportunity op:opp){
op.CSFA__Gateway__c= GatewayId;
oplst.add(op);
}
}
update oplst;
}
if (place == 1) { medal_color = 'gold'; } else if (place == 2) { medal_color = 'silver'; } else if (place == 3) { medal_color = 'bronze'; } else { medal_color = null; }
Hope you are able to fix this. let us know otherwise ;)
Regards, Manmohan