This is the error shown when I click on javascript button

Code which is working


Code which is not working

if({!Case.Status}  =  'Closed'){
    alert('Case is Closed cannot update.');

If statement is being validated alert is shown, but there is some issue with else. What could be the possible solution.


In any programming language:

  1. = means Assignment
  2. == means Comparison

Also JavaScript is Dynamically typed programming languages, so you have to be careful while comparison. Status should be in quotes!

So, try changing:

if({!Case.Status}  =  'Closed')


if("{!Case.Status}" == "Closed")
| 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.