Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Client script 'if not' is not working

Srvs
Kilo Guru
function onLoad() {
    if (!('u_managed_by_last_certified' == '' || 'u_managed_by_last_certified' == null)) {
        g_form.setValue('u_verification_method', 'Data Certification');
        g_form.setValue('u_last_verification_date', g_form.getValue('u_managed_by_last_certified'));
    }
}
 
the above script is not working, please help if anyone has faced this type of issue.
1 ACCEPTED SOLUTION

Harish Bainsla
Kilo Patron
Kilo Patron

Hi @Srvs  try below code

function onLoad() {
var managedByLastCertified = g_form.getValue('u_managed_by_last_certified');

if (managedByLastCertified !== '' && managedByLastCertified !== null) {
g_form.setValue('u_verification_method', 'Data Certification');
g_form.setValue('u_last_verification_date', managedByLastCertified);
}
}

View solution in original post

1 REPLY 1

Harish Bainsla
Kilo Patron
Kilo Patron

Hi @Srvs  try below code

function onLoad() {
var managedByLastCertified = g_form.getValue('u_managed_by_last_certified');

if (managedByLastCertified !== '' && managedByLastCertified !== null) {
g_form.setValue('u_verification_method', 'Data Certification');
g_form.setValue('u_last_verification_date', managedByLastCertified);
}
}