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
Pablo GarfunkelPablo Garfunkel 

IF AND conditions in row level formula

Hi, hoping someone can tell me what am I doing wrong here.
Trying to prooduce a custom formula that:
  • will return "Comm" if opportunity type is New Logo or Cross Sell
  • will return "n/a" if sum:maint = sum:amount
  • will return "n/a" if opportunity type is Renewal
  • will return "Comm" if opportunity type is Upsell AND CSE Booking field is 'Yes'
  • ELSE it should return "n/a"
Here's the formula I plotted; it keeps gicing me Error when encoding row-level formula: Syntax error. Extra ','

IF (ispickval(TYPE),"New Logo"), "Comm",
IF (ispickval(TYPE),"Cross-Sell"), "Comm",
IF (ispickval(TYPE),"Renewal"), "n/a",
IF (Opportunity.Sum_Maintenances__c.CONVERT=AMOUNT.CONVERT),"n/a",
IF (AND(ispickval(TYPE),"Upsell"),(ispickval(Opportunity.CSE_Booking__c),"Yes"),"Comm","n/a")))))



Thanks in advance!
Best Answer chosen by Pablo Garfunkel
Jaya Karthik  karnatiJaya Karthik karnati
Hi Pablo,

The issue with your formula is that syntax of ispickval is incorrect , The ispickval closing bracket must end after the comparision value like :
ISPICKVAL(picklist_field, text_literal)
Documentation : https://help.salesforce.com/s/articleView?id=sf.customize_functions_ispickval.htm&type=5
 
IF(ispickval(TYPE, "New Logo"), "Comm",
    IF(ispickval(TYPE, "Cross-Sell"), "Comm",
    	IF(ispickval(TYPE, "Renewal"), "n/a",
		IF (Opportunity.Sum_Maintenances__c.CONVERT=AMOUNT.CONVERT,
			"n/a",
				IF (AND(ispickval(TYPE,"Upsell"),ispickval(Opportunity.CSE_Booking__c,"Yes")),
					"Comm",
						"n/a")))))

and also if you are comparing 2 values we should not end the bracket of IF condition before the values.

Hope this helps, If so kindly mark it as best answer

Thanks,
Karthik


 

All Answers

Jaya Karthik  karnatiJaya Karthik karnati
Hi Pablo,

The issue with your formula is that syntax of ispickval is incorrect , The ispickval closing bracket must end after the comparision value like :
ISPICKVAL(picklist_field, text_literal)
Documentation : https://help.salesforce.com/s/articleView?id=sf.customize_functions_ispickval.htm&type=5
 
IF(ispickval(TYPE, "New Logo"), "Comm",
    IF(ispickval(TYPE, "Cross-Sell"), "Comm",
    	IF(ispickval(TYPE, "Renewal"), "n/a",
		IF (Opportunity.Sum_Maintenances__c.CONVERT=AMOUNT.CONVERT,
			"n/a",
				IF (AND(ispickval(TYPE,"Upsell"),ispickval(Opportunity.CSE_Booking__c,"Yes")),
					"Comm",
						"n/a")))))

and also if you are comparing 2 values we should not end the bracket of IF condition before the values.

Hope this helps, If so kindly mark it as best answer

Thanks,
Karthik


 
This was selected as the best answer
Pablo GarfunkelPablo Garfunkel
Thanks Karthik! That worked!