-2

I have been trying hard for hours now, I had an issue with the syntax, that is solved here https://salesforce.stackexchange.com/questions/357454/error-on-salesforce-custom-formula-field-says-extra-comma?noredirect=1#comment520345_357454.

I have this formula on a custom field

If(
    TEXT(Test.Cold.Type__c) = '' 
    || ISPICKVAL(Sale__r.Test__c, 'Sold') 
    || TEXT(Test.Cold.Type_Set__c) = ''
),0,1).

If I just do as below with first two condition, it works,

If(
    TEXT(Test.Cold.Type__c) = '' 
    || ISPICKVAL(Sale__r.Test__c, 'Sold'),0,1)

but if I add the third condition which is || TEXT(Test.Cold.Type_Set__c) = '', the first condition does not work. What am I missing here?

1

There was one extra ). Because of this it is not working. You remove it and update the formula as below.

IF(OR( ISBLANK( TEXT(Test.Cold.Type__c) ),ISPICKVAL(Sale__r.Test__c, 'Sold') ,ISBLANK( TEXT(Test.Cold.Type_Set__c)) ),0,1)
6
  • There were no syntax errors. It is just not working as expected.
    – sumchans
    Sep 14 at 4:17
  • Can you update the formula as above and check. Because i see the syntax error there. if any of the above three conditions meet the value should be 0 or else it should be 1. Is this the requirement? Sep 14 at 4:23
  • Maybe that was a copy paste error. The logic is exactly as you said.
    – sumchans
    Sep 14 at 4:24
  • Insted of || operator did you tried OR condition and also TEXT(Test.Cold.Type__c) = '' insted of this replace it with ISBLANK(TEXT(Test.Cold.Type__c)). The same way with the other null check as well. This should resolve your issue Sep 14 at 4:30
  • Try using this formula. Hope this will work. If( OR( ISBLANK( TEXT(Test.Cold.Type__c) ) , ISPICKVAL(Sale__r.Test__c, 'Sold') , ISBLANK( TEXT(Test.Cold.Type_Set__c)) ),0,1) Sep 14 at 4:46
0

The issue was about not grouping the first two conditions. This way it worked for me.

If((TEXT(Test.Cold.Type__c) = '' || ISPICKVAL(Sale__r.Test__c, 'Sold')) && TEXT(Test.Cold.Type_Set__c) = ''),0,1)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.