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
Sunny NarulaSunny Narula 

Formula Field with CASE operator

I have a Formula field named "Net Amount" (below is the formula for that)
based on record type I need to calcuated the "Net Amount"..


CASE ($RecordType.Name , 
"US Opportunity", Amount__c*0.62, 
"US Jobber Opportunity", Amount__c*0.62, 
"Authentication", Est_Opportunity_Volume__c*Est_Selling_Price__c, 
"US Opportunity - Approved", Amount__c*0.62,
"US Free Goods Opp" , Amount__c*0.62, 
"US Free Goods Opp - Approved" , Amount__c*0.62,
"US Lost Account" , Amount__c*0.62,
"AUS Record Type" , Amount__c * 12,
"US DuPont Legacy Opportunity" ,Amount__c * 0.62,
"DPC-AP" ,Amount__c * 12,
"IND-AP" , Amount__c / Contract_Duration__c,
0)

Everthing works fine until "Contract_Duration__c" is not 0 (zero) or NULL
Even if the incoming RecordType not equal to "IND-AP" and "Contract_Duration__c" is null or 0
the result is #Error!

Requesting to please help me out how to set this..
as if the recordType not equal to "IND-AP" things should work...

thanks in advance
Sunny

Best Answer chosen by Sunny Narula
Anoop yadavAnoop yadav
Hi,

Try with the below code.

CASE ($RecordType.Name ,
"US Opportunity", Amount__c*0.62,
"US Jobber Opportunity", Amount__c*0.62,
"Authentication", Est_Opportunity_Volume__c*Est_Selling_Price__c,
"US Opportunity - Approved", Amount__c*0.62,
"US Free Goods Opp" , Amount__c*0.62,
"US Free Goods Opp - Approved" , Amount__c*0.62,
"US Lost Account" , Amount__c*0.62,
"AUS Record Type" , Amount__c * 12,
"US DuPont Legacy Opportunity" ,Amount__c * 0.62,
"DPC-AP" ,Amount__c * 12,
"IND-AP" , IF((ISBLANK(Contract_Duration__c) || Contract_Duration__c == 0 ), 0, Amount__c / Contract_Duration__c),
0)

All Answers

Anoop yadavAnoop yadav
Hi,

Try with the below code.

CASE ($RecordType.Name ,
"US Opportunity", Amount__c*0.62,
"US Jobber Opportunity", Amount__c*0.62,
"Authentication", Est_Opportunity_Volume__c*Est_Selling_Price__c,
"US Opportunity - Approved", Amount__c*0.62,
"US Free Goods Opp" , Amount__c*0.62,
"US Free Goods Opp - Approved" , Amount__c*0.62,
"US Lost Account" , Amount__c*0.62,
"AUS Record Type" , Amount__c * 12,
"US DuPont Legacy Opportunity" ,Amount__c * 0.62,
"DPC-AP" ,Amount__c * 12,
"IND-AP" , IF((ISBLANK(Contract_Duration__c) || Contract_Duration__c == 0 ), 0, Amount__c / Contract_Duration__c),
0)
This was selected as the best answer
Sunny NarulaSunny Narula
thanks Anoop :)