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
Seth RosenSeth Rosen 

Syntac Error Code

Ok folks. U.S. Army veteran here training to be a SalesForce Certified Systems Administrator and I have a question about some code I am typing up.  I have typed up the following code to use for a custom formula and am getting a Syntax error and not sure why. 

IF(ISPICKVAL(picklist_field, ("Closed Won" StageName Amount  * 0.1, 0) = Incorrect Syntax Error

IF( ISPICKVAL( StageName , "Closed Won") , Amount  * 0.1, 0) = Correct No Syntax Error

Can someone explain to me in English why I am getting a syntax error code of the first one. After a while I figured out why it wasn't working, but I am not a coder or developer so any help and explanation you could give me would be great. 

My email is srosen101@gmail.com. For someone kind enough to take the time to answer my question, could you please email me as well. Thanks. 

 
Best Answer chosen by Seth Rosen
Himanshu ParasharHimanshu Parashar
Hi Seth,

You are getting error in your code because you have two syntax error in your formula. Lets break it in two part. you are using two syntax. 

1. ISPICKVAL(picklist_field,value)

in this picklist_field is fieldname against which you want t compare. You have created this formual on Opportunity where StageName is a field that is why second formula is not throwing any error. if you create picklist_field name field on opportunity you will not get error for first formula as well for ISPICKVAL

2. IF (Condition, Value if condition is True, Value if condition is False)

If you will check your formula you have two open bracket but only one closing bracket.

Makes sense ?


Thanks,

Himanshu

Salesforce Certified Developer | Administrator | Service Cloud Consultant

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.

All Answers

Himanshu ParasharHimanshu Parashar
Hi Seth,

You are getting error in your code because you have two syntax error in your formula. Lets break it in two part. you are using two syntax. 

1. ISPICKVAL(picklist_field,value)

in this picklist_field is fieldname against which you want t compare. You have created this formual on Opportunity where StageName is a field that is why second formula is not throwing any error. if you create picklist_field name field on opportunity you will not get error for first formula as well for ISPICKVAL

2. IF (Condition, Value if condition is True, Value if condition is False)

If you will check your formula you have two open bracket but only one closing bracket.

Makes sense ?


Thanks,

Himanshu

Salesforce Certified Developer | Administrator | Service Cloud Consultant

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
This was selected as the best answer
Seth RosenSeth Rosen
Himanshu, 
Thank you for taking the time to write me back and anwer my question, it is greatly appreciated and you are a hugh help. Have a great day.