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
pavan kumar 1864pavan kumar 1864 

formula field on opportunity custom field name Partner_involved__c

I have a formula field name Partner_involved__c on opportunity object, it should be marked 'true' when amount field in opportunity object is not blank, so i have written a formula-

IF(ISBLANK(Amount),"True","False")

but here irrespective of the amount field whether it is blank or not ,
The Formula field named Partner_involved__c is marking as 'False'.


Can anyone please explain how i can overcome this.
Best Answer chosen by pavan kumar 1864
CharuDuttCharuDutt
Okay I Thought It Was A CheckBox Field Now  BElow Both Method Is Working On My Org As Your Formula Return Data Type is Text  Naow Try Below Code After Refreshing Dev Console Window And Org Window
Formula
IF(NOT(ISBLANK( Amount )),'True','False')

Apex Code
 if(acc.Amount == 'True'){
           system.debug('Hello');
       }

All Answers

CharuDuttCharuDutt
Hii Pavan kumar
Try Below Formula
IF(NOT(ISBLANK( Amount)),True,False)
Please Mark It As Best Answer If It Helps Thank You!
 
pavan kumar 1864pavan kumar 1864
Hi,Charu
I got a Error
Error: Formula result is data type (Boolean), incompatible with expected data type (Text).
CharuDuttCharuDutt
Hii Pavan 
It's Working In My Org  
Just Copy Paste Below Code
IF(NOT(ISBLANK( Amount)),True,False)
Please Mark It As Best Answer If It Helps Thank You!
 
CharuDuttCharuDutt
Don't Put True False In Quotes

Should Be
IF(NOT(ISBLANK( Amount)),True,False)
Should Not Be
IF(NOT(ISBLANK( Amount)),"True","False")

Please Mark It As Best Answer If It Helps Thank You!
pavan kumar 1864pavan kumar 1864
I have copy pasted your code but still the error is popping up dont know why.

I wanted the formula field to return 'True' so that i can use it in if condition like 
if(Partner_involved__c ==  'true')
{
Logic.............
}
 
CharuDuttCharuDutt
Try This
if(Partner_involved__c ==  true)
{
Logic.............
}
 
pavan kumar 1864pavan kumar 1864
ok in the code i will take off quotes but in the formula field its not allowing me to save your code :(
CharuDuttCharuDutt
There Will Be No Quotes In Formula Or Apex Code True/false In Boolean Condition Doesn't Come in Quotes

IF(NOT(ISBLANK( Amount)),True,False)

And
if(Partner_involved__c ==  true)
{
Logic.............
}
 
pavan kumar 1864pavan kumar 1864
image
See Brother,Dont know why
pavan kumar 1864pavan kumar 1864
in formula i have taken return type as Text
CharuDuttCharuDutt
Okay I Thought It Was A CheckBox Field Now  BElow Both Method Is Working On My Org As Your Formula Return Data Type is Text  Naow Try Below Code After Refreshing Dev Console Window And Org Window
Formula
IF(NOT(ISBLANK( Amount )),'True','False')

Apex Code
 if(acc.Amount == 'True'){
           system.debug('Hello');
       }
This was selected as the best answer
RajivKocherlaRajivKocherla
Hi,
    Pavan you need to make sure you do the following
a) Please take away the inverted commas around the words True & False
b) Go to the Object Manager and Opportunity Object and in the fields select your formula field and click edit and scroll all the way to the bottom and in the Blank Fields Handling Section select the Radio Button that says Treat Blank Fields as blanks then your formula works as you want.
pavan kumar 1864pavan kumar 1864
Thanks Charu, here "" was the culprit ,i was not knowing that we should not use "" in formula fields