What could be wrong with this code? I'm fairly new to javascript and I've been trying to debug on my own to no avail.
The alert('confirmed: ' + records[i].ENQ_Confirmed_with_Enbridge__c); shows false but it won't pass the if condition so my counter isn't incrementing.
Same goes with if(records[i].ENQ_QSC_Notified__c === false even if the value of the field is false, it doesn't pass the condition as well.
var assPac = new sforce.SObject("ENQ_Assignment_Package__c");
var qscContact = '{!ENQ_Assignment_Package__c.ENQ_QSC_Contact__c}';
var status = '{!ENQ_Assignment_Package__c.ENQ_Status__c}';
var otherP = sforce.connection.query("Select
Id,ENQ_Confirmed_with_Enbridge__c,ENQ_QSC_Notified__c FROM
ENQ_QSR_Assignment__c where ENQ_Assignment_Package__c =
'{!ENQ_Assignment_Package__c.Id}'");
var records = otherP.getArray("records");
for(var i=0; i<records.length; i++){
alert('confirmed: ' + records[i].ENQ_Confirmed_with_Enbridge__c);
if(records[i].ENQ_Confirmed_with_Enbridge__c === false){
alert('check');
counter++;
}
alert('counter: ' + counter);
if(records[i].ENQ_QSC_Notified__c === false){
records[i].ENQ_QSC_Notified__c = true;
qscNotified.push(records[i]);
}
}
alert('qscNotified: ' + qscNotified.length);
Any help would be appreciated.