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
thuskerthusker 

Validation rule question - dealing with multicurrency

Could use some help . . . I created some validation rules to impose certain restrictions on a discount request functionality we have.  Works great, when someone plugs in an amount of $10k or more, the validation rule triggers and stops the save. 

 

The problem is that we have multicurrency enabled--I was expecting the validation rule to catch the conversion rate and to prevent someone from entering what would be over the $10k USD amount . . . that doesn't happen!!!  If I switch the currency on the record to GBP and put in $9000, the record saves.  It only errors when I hit the 10000 value regardless of the currency (and 9999 GBP is way more than $9999 USD).  The formula I am using is below.

 

AND(ISPICKVAL( Is_this_a_10k_10percent_NST__c , "Yes"),Hardware_Incremental_DiscountUSD__c >=10000)

 

This is a HUGE problem . . . I need to have this rolled out by Monday and if the system is letting larger GBP/EUR discounts run through without stopping them it will be a disaster.  How do you get a validation rule to take multicurrency into account???  Or can it?

 

 

thuskerthusker

Well . . . may have found the right thing.  Still testing.  Apparently SFDC Support made a change to the original validation rule changes they suggested and this does seem to be working on the few tests I made.  Here is the formula that I am working from.

 

OR(
      AND( ISPICKVAL (CurrencyIsoCode , "USD"),
                 ISPICKVAL( Is_this_a_10k_10percent_NST__c , "Yes"),
                 Hardware_Incremental_DiscountUSD__c >=  10000),
      AND( ISPICKVAL (CurrencyIsoCode , "EUR"),
                 ISPICKVAL( Is_this_a_10k_10percent_NST__c , "Yes"),
                 Hardware_Incremental_DiscountUSD__c >=  8000),
      AND( ISPICKVAL (CurrencyIsoCode , "GBP"),
                 ISPICKVAL( Is_this_a_10k_10percent_NST__c , "Yes"),
                 Hardware_Incremental_DiscountUSD__c >=  6029))

Message Edited by thusker on 11-12-2009 09:22 PM
ron_reedron_reed

We use an apex trigger that converts the amount to US Dollars.  The apex trigger looks at the amount and currency type, converts it to US Dollars and places the converted amount into a new field we call Amount USD.  Then you can use that new custom field for whatver reporting or validation rules you want.  This is based off of code that is generously provided on the salesforce and more blog:

 

http://www.sfcnmore.com/index.php/2009/01/sfc-multi-currency-improvement/