Client script is not working on my Instance.

aakankshapl
Tera Expert

Hello
On my instance any type of client script is not working. My story is stuck from two days because of this issue.
What could be reason and solution for this to resolved.
Your help will be alot for me 

Thanks & Regards,
Aakanksha Lavande

21 REPLIES 21

I would suggest raising a Hi Support case with ServiceNow because any client script not working at all in customer instance is a big issue. 
https://support.servicenow.com/now

 

 

If my answer helps you in any way please mark it as correct or helpful.

Thank you for you suggestion, but after so many trials I observed that my client script is running only for new record, It doesn't work on existing record.

Again, cannot say for sure what is causing the issue without looking at the code.
Have a look at the client scripts, check the code, see if any condition is mentioned.

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '' ) {
      return;
   }

   var trustedDomains = g_form.getValue('u_trusted_email_domain_s');
    alert(trustedDomains);
    var domainArray = trustedDomains.split(', ');

    for (var i = 0; i < domainArray.length; i++) {
        if (!domainArray[i].startsWith('@')) {
            g_form.addErrorMessage('Each domain must start with "@"');
            return false;
        }
    }

    return true;
}

I need to add a new custom field to the Account form to facilitate the tracking and validation of email domains that are trusted by each client.
This field, named "Trusted Email Domain(s)" (u_trusted_email_domains), will be a string field where users can input email domains that are considered secure and reliable for communications related to the account.
Domains must be entered with an "@" sign at the beginning, and multiple domains should be separated by a comma.

 

The above script is an onChange Client script, you don't need to return true/false for it as the record is not yet submitted. 
Remove the return true and return false and your script should work correctly.

 

 

If my answer has helped you in any way please mark it as correct or helpful.