AddThis Feed Button

Recent Items

Tags: s-controls

Can you spot the error in this code?

if ( {!Contact.Department} == 'Finance' )
...

Come on — try and guess it before reading the next paragraph!

The problem is that Salesforce.com inserts the value of the variable within the S-Control text, resulting in this:

if ( Finance == 'Finance' )

It should really go in quotes like this:

if ( '{!Contact.Department}' == 'Finance' )

That one gets me every time!

The Bottom Line

  • Quote inserted field names when they are strings

Comments are closed.