I've got functional code to test if a PRD is attempting to modify an
existing object (phone extensions) instead of creating a new extension.

When modifying an existing extension, certain values are supposed to be
pre-filled in the form from that existing object.

All work, except the boolean value for "phoneAvailable" is not returning
accurately. The form field is boolean TrueFalseCheckbox, and it always
returns true (or appears as "checked.")

Can someone spot the error that makes this boolean fail, when similar
code for text values works fine? Given Name, Surname, and Description
all return fine.

var z = field.getValue();
if (z != "")
var v = IDVault.globalQuery(null, "phone", {"cN":z});
if (v[0]!="") {
form.showMsg("You are Modifying an existing Extension.");
// form.setValues("Owner", (IDVault.get(null, String(v[0]),
'ClientPhone', 'Owner')));
var own = IDVault.get(null, String(v[0]), 'ClientPhone', 'Owner');
if (own[0]!="") {
else {
form.setValues("Owner", '');
form.setValues("Surname", (IDVault.get(null, String(v[0]),
'ClientPhone', 'Surname')));
form.setValues("Given_Name", (IDVault.get(null, String(v[0]),
'ClientPhone', 'GivenName')));
form.setValues("Description", (IDVault.get(null, String(v[0]),
'ClientPhone', 'Description')));

==============Relevant/failing line here ============================
form.setValues("ClientPhoneAvailable", (IDVault.get(null,
String(v[0]), 'ClientPhone', 'ClientPhoneAvailable')));

===============End Relevant line====================

var j = (IDVault.get(null, String(v[0]), 'ClientPhone', 'jobCode'));
if (j!="") {
// field.fireEvent("jobexists");
// form.setValues("jobCode", (IDVault.get(null, String(v[0]),
'ClientPhone', 'jobCode')));
} else {
var loc = (IDVault.get(null, String(v[0]), 'ClientPhone',
if (loc!="") {
// field.fireEvent("locexists");
// form.setValues("ClientSA", (IDVault.get(null, String(v[0]),
'ClientPhone', 'l')));
} else { }
var dnval = "cn="+z+",ou=pho,ou=res,o=data";
// form.showMsg("DN value is: "+dnval);
form.setValues("dn", dnval);
form.setValues("Owner", '');
form.setValues("Surname", '');
form.setValues("Given_Name", '');
form.setValues("Description", '');
form.setValues("ClientPhoneAvailable", '');
form.setValues("jobCode", '');
form.showMsg("You are creating a NEW Extension");