I have below code that gives out error with Form custom object's Id value as not defined. Can someone please help?


  • 1
    Can you please change the question title ? – Jarvis Feb 23 '16 at 13:11
  • 1
    A clear title is a good norm – Jarvis Feb 23 '16 at 13:41

Apex variables are not part of Javascript runtime, they are rendered from server side.

  • You need to enclose the Apex variables with single quote in client side.

Try this:


Even though above code will work its better to JSENCODE the Apex variables to avoid XSS vulnerablity:


If you apply for security review, all these vulnerabilities will raise serious red flags, so its better to follow it.

| improve this answer | |

Try the below code :

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.