+ Start a Discussion
vijju123_1vijju123_1 

formula field

hello

 dis is vijay

 

 

im trying to  use a formula in my field(father annual income) in a candidate object.my criteria is default value should be 50000$ per annum when a field is empty.im using NULLVALUE(null,50000) but its not getting..waitng for solution.im new to sfdc,need help.thanks in advance..

Best Answer chosen by Admin (Salesforce Developers) 
Kamatchi Devi SargunanathanKamatchi Devi Sargunanathan

Hi vijay,

 

I got your question now. You need to have the field 'Family_Annual_Income__c' and the same field is going to have this formula right?

 

Then go a head and in the Default Value option of the currency field 'Family_Annual_Income__c', just give the value as 50000. That's enough, you don't need to write a formula for that.

 

That error thrown because you cannot refer any of the fields in the default value (formula in default value). Hope you understand.

 

Hope this will help you...!

 

Please don't forget to give kudos by clicking on the Star icon and mark this as a solution, if this works out.

All Answers

Kamatchi Devi SargunanathanKamatchi Devi Sargunanathan

Hi Vijay,

 

To do this your formula to be written like follows,

 

First, Create a formula field with return type Currency.

 

If( (father_annual_income__c == null), 50000,  father_annual_income__c)

 

The above formula returns a value 50000$ if the father_annual_income__c == null, else it will the return the field value itself.

 

 

vijju123_1vijju123_1

Hello Kamatchi Devi R

 

thanks for ur reply

                           actually i created a Currency data type(Family_Annual_Income__c) after creating the field later im using formula to that field.i used the code given by you(If( (Family_Annual_Income__c == null),50000,  Family_Annual_Income__c)) but it throwing a error(Error: Field Family_Annual_Income__c may not be used in this type of formula)
..                         i think i cant use the field name or api(Family_Annual_income__C),then how the code works..

 

Kamatchi Devi SargunanathanKamatchi Devi Sargunanathan

Hi,

 

So, please answer the following questions.

 

1) What is the data type of the field Family_Annual_Income__c?'

2) What is the return type of formula?

 

vijju123_1vijju123_1

hello

 

i given Data type as Currency and RETURN TYPE  Currency..

Kamatchi Devi SargunanathanKamatchi Devi Sargunanathan

Hi vijay,

 

I got your question now. You need to have the field 'Family_Annual_Income__c' and the same field is going to have this formula right?

 

Then go a head and in the Default Value option of the currency field 'Family_Annual_Income__c', just give the value as 50000. That's enough, you don't need to write a formula for that.

 

That error thrown because you cannot refer any of the fields in the default value (formula in default value). Hope you understand.

 

Hope this will help you...!

 

Please don't forget to give kudos by clicking on the Star icon and mark this as a solution, if this works out.

This was selected as the best answer
vijju123_1vijju123_1

yup it works... thanks Kamatchi Devi R....

Kamatchi Devi SargunanathanKamatchi Devi Sargunanathan
That's great thank you.