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
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 !!