+ Start a Discussion
Amal JoyAmal Joy 

I have two records .When I enter US dollar in first record and change focus from US dollar Euro filed should automatically fill corresponding Euro value.What kind of trigger i should use.The problem with my code is that it will populate only after saving.

trigger conversion on Create_Opportunities__c (Before Insert) {
for (Create_Opportunities__c a : Trigger.New){
a.Amount_in_Euro__c= .879*a.Amount_in_USD__c; 

Hi Amal,

I can see that your requirement is to update the second field value once the focus out from first field, you can achieve this if you have your custom VF page layout, on standard layout you can only create a formula field to get the Euro converted amount. 

You can't achieve this using trigger, trigger only work once the DML perform and not on page components events. Not much recommended but you can try inline VF page on your standard layout, just keep those two fields and on changing of first fields reflect the value in second field. Let me know if it answers your question.