function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
pratyusha raavipatipratyusha raavipati 

automatic update of currency

Hi, 

I have account object with field currency as pick list 

pick list values are

USD
CAD
GBP
EUR


depending on the picklist selected automatically currency have to be updated 
Products and quotes

i mean  for example
i have selected EUR list price in products should be in EUR same in quotes
from past 2 days i am working on this i did not find the way 
please help me

THANKS & REGARDS
PRATYUSHA.K
Anilkumar KotaAnilkumar Kota
Hi Prathyusha ,

Hope the following trigger will help you .
trigger DateTrigger on account(before insert,before update,after insert, after update){
     
    if(trigger.isafter){
        if(trigger.isUpdate || trigger.isInsert){
            list<quote> quolist=[select id,name,accountid,Currency__c,account.Currency__c from quote where accountid IN: trigger.new];
               for(Quote quo:quolist){
                  quo.Currency__c =quo.account.Currency__c ;
                  }
                  update quolist;
        }
    }
    
    if(trigger.isafter){
        if(trigger.isUpdate || trigger.isInsert){
              
            list<product2> prolist=[select id,name,Currency__c,Account__r.Currency__c from product2 where Account__r.id IN: trigger.new];
               for(product2 pro:prolist){
                  pro.Currency__c =pro.Account__r.Currency__c;
                  }
                  update prolist;
        }
    }

}

By using Process Builder also you can able to update .