Friday, November 30, 2018

Resolving Javascript Error Invalid assignment left-hand side

 

Most probably this is actually a syntax error. This pertains to proper use of operators such as incorrectly switching double "=="
to single "="

When you check for a value, you put "==" double equal signs rather than single "=" equal sign.
With single "=", you are actually assigning a value to a variable.
 

Example incorrect code that generates the Error "Invalid assignment left-hand side":
------------------
if (varA = varB) {
   varA == nlapiSetFieldValue('fieldA');
}
------------------

Correct code:
------------------
if (varA == varB) {
   varA = nlapiSetFieldValue('fieldA');
}
------------------

No comments:

Post a Comment