Client script is not working on my Instance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-22-2024 11:21 PM - edited ā04-22-2024 11:26 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-23-2024 12:47 AM - edited ā04-23-2024 12:47 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-23-2024 01:01 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-23-2024 01:06 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-23-2024 01:38 AM - edited ā04-23-2024 01:39 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-23-2024 01:59 AM
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.