Reputation: 506
I don't understand why I'm getting the above mentioned error with following code :
value1 = sessionScope.get("selectedPicture");
if (value1 != "empty"){
var db:NotesDatabase = session.getDatabase(database.getServer(), "product\\picture.nsf");
if (db != null) {
var IDtoChange = toString("7D59468E241AC271C1257D5000417E46") ;
if (IDtoChange = null){
return
}
try {
doc = db.getDocumentByUNID(IDtoChange);
doc.replaceItemValue( 'picWeb', "true" );
doc.save( true, false );
sessionScope.put("selectedUnid","");
} catch(e) {
sessionScope.put("error",(e.toString()));
context.redirectToPage("errorPage.xsp");
}
}
}
When I replace the line doc = db.getDocumentByUNID(IDtoChange); with doc = db.getDocumentByUNID("7D59468E241AC271C1257D5000417E46"); everything works fine
What is wrong ? (in my real code the id isn't hard coded of course)
Upvotes: 0
Views: 802
Reputation: 1417
Should line six be if (IDtoChange == null){
instead of if (IDtoChange = null){
. The single =
looks to be assigning the value instead of comparing which is ==
Upvotes: 4