Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
public static void Opportunitycurrency (List<Opportunity> newOptyList) { List<Id> oppOwnerIds = new List<Id>(); for(Opportunity opp: newOptyList) { if(opp.OwnerId != null) { oppOwnerIds.add(opp.OwnerId); } } Map<Id, User> userList = new Map<Id, User>([SELECT Id, Name, CurrencyIsoCode FROM User WHERE Id IN :oppOwnerIds]); for(Opportunity opp: newOptyList) { if(opp.type != 'Renewal') { opp.currencyisocode=userList.get(opp.OwnerId).currencyisocode; } } }
trigger Assignment2 on Opportunity (before insert) { if(trigger.isBefore && trigger.isInsert){ Opportunitycurrency.currencyMethod(trigger.new); } } public class Opportunitycurrency { public static void currencyMethod (List<Opportunity> newOptyList) { List<Id> oppOwnerIds = new List<Id>(); for(Opportunity opp: newOptyList) { if(opp.OwnerId != null) { oppOwnerIds.add(opp.OwnerId); } } Map<Id, User> userList = new Map<Id, User>([SELECT Id, Name, CurrencyIsoCode FROM User WHERE Id IN :oppOwnerIds]); for(Opportunity opp: newOptyList) { if(opp.type != 'Renewal') { opp.currencyisocode=userList.get(opp.OwnerId).currencyisocode; } } } }
Greetings to you!
I have written the following code as per your requirement. Please try the below code.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com
All Answers
Greetings to you!
I have written the following code as per your requirement. Please try the below code.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com
Use bellow trigger it may helpful for you
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com