You need to sign in to do that
Don't have an account?
Bayarea 101
Opportunity update trigger
What i am trying to acehive here are 2 things.
1. When an Opportunity is updated this trigger should look for a custom object. If there is a custom object is available than fire other wise not.
2. Once this trigger is fired certain fields on the opportunity should be updated.
trigger Oppupdate on Opportunity (After update)
{
Opportunity Opp = [Select ID broker_firm__c, broker_firm_office__c, primary_contact_role__c from Opportunity WHERE ID In:Trigger.newMap.keySet()];
Underwriting__c U=[Select ID Opportunity__c from Underwriting__c where Opportunity_Id__c =:Opp.Id];
For (Opportunity O:Trigger.new){
U.broker_firm__c = o.broker_firm__c;
U.broker_firm_office__c = o.broker_firm_office__c;
U.broker_name__c = o.primary_contact_role__c;
}
}
1. When an Opportunity is updated this trigger should look for a custom object. If there is a custom object is available than fire other wise not.
2. Once this trigger is fired certain fields on the opportunity should be updated.
trigger Oppupdate on Opportunity (After update)
{
Opportunity Opp = [Select ID broker_firm__c, broker_firm_office__c, primary_contact_role__c from Opportunity WHERE ID In:Trigger.newMap.keySet()];
Underwriting__c U=[Select ID Opportunity__c from Underwriting__c where Opportunity_Id__c =:Opp.Id];
For (Opportunity O:Trigger.new){
U.broker_firm__c = o.broker_firm__c;
U.broker_firm_office__c = o.broker_firm_office__c;
U.broker_name__c = o.primary_contact_role__c;
}
}
For second condition, the code(multi group reference data model - List/set/Map) given by Karanraj will work for your requirement.
All the best!