- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2019 12:11 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2019 12:37 AM
HI Ashwini,
if you need to Onchange client script is behavior like Onchange as well as onload -:
do the simple change in if condition remove the isLoading ||
eg.
function onChange(control, oldValue, newValue, isLoading) {
if ( newValue == '') {
//put your code here
return;
}
}
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2019 12:17 AM
Hi,
You can refer below url
https://community.servicenow.com/community?id=community_question&sys_id=6e501729dbdcdbc01dcaf3231f961936
Mark it correct or helpful , If it helps you.
Thanks,
Snehal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2019 12:18 AM
Hi Ashwini,
Yes, we can do that.
Whatever you want to do on load, put that inside if statement.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '')
{
// Put your onload scripting here
return;
}
//Type appropriate comment here, and begin script below
}
Mark correct based on impact of response.
Regards,
Devyani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2019 12:19 AM
Hi,
Else you can use below script.
Default:
if (isLoading || newValue == '')
Change it to
if (newValue == '')
It will run when the form is loading.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2019 12:23 AM
Thank you,
I got it,but what is the need to change onChange client script into onLoad.