+ Start a Discussion
Prachi VijayvargiyaPrachi Vijayvargiya 

Error in compiling

Hi This is my code.

trigger trigger1 on Record__c(before insert,before update){
for(Record__c r:Trigger.new){
 if(r.Room_Type__c==Single Room){
  r.Discount_Per__c='5';
     }
   }
}

And the error i am getting is Compile Error: Extra ')', at 'Room'. at line 3 column 28.

Can someone help.
VamsiVamsi
Hi,

Make the Single Room surrounded with single quotes as below 
if(r.Room_Type__c== 'Single Room')
{
  r.Discount_Per__c='5';
}
Prachi VijayvargiyaPrachi Vijayvargiya
Hi Vamsi,

I tried and it gave an error again.
I then removed "5" from quotes and it worked.
Thanks a lot:)
VamsiVamsi
Great !!