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
lopezclopezc 

Unexpected token error: if(39 < loopContact.MiFID_Total_Points__c < 80)

Hi,

 

I am getting Save error: Unexpected token:  

 

when saving to the server, here is the code and in red the line with the error:

 

 if(39 < loopContact.MiFID_Total_Points__c < 80){
                if(loopContact.Application_Date__c < dueDate){
                    sendEmailUpgrade(loopContact, 1); //EMAIL UPGRADE1
                } else {
                    sendEmailUpgrade(loopContact, 2); //EMAIL UPGRADE2
                }
 } else {

 .................

 }

 

Any Ideas?  MiFID_Total_Points__c is a number

 

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
jeffdonthemicjeffdonthemic

I think you are getting the "unexpected token" error because the syntax is incorrect. I think you have too many evaluations in your expression:

 

 if(39 < loopContact.MiFID_Total_Points__c < 80){

 

I think would need to be chaged to something like:

 

 if(39 < loopContact.MiFID_Total_Points__c){

 

Hope this helps

 

Jeff Douglas
Informa Plc
http://blog.jeffdouglas.com

All Answers

jeffdonthemicjeffdonthemic

I think you are getting the "unexpected token" error because the syntax is incorrect. I think you have too many evaluations in your expression:

 

 if(39 < loopContact.MiFID_Total_Points__c < 80){

 

I think would need to be chaged to something like:

 

 if(39 < loopContact.MiFID_Total_Points__c){

 

Hope this helps

 

Jeff Douglas
Informa Plc
http://blog.jeffdouglas.com

This was selected as the best answer
sathisathi

im getting unexpected token:'if'    pls tell me how to resolve it

my code is


trigger trgz on contact(before insert)
{
for(contact c:trigger.new)
{
integer cnt=[select count() from contact where accountid=:c.accountid]
if(cnt>=3)
c.adderror('contact limit is reached-3');
}
}