- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2022 02:59 AM
Hi everyone,
My requirement is to show and hide UI action based on change of field on form . Form that I have created on change client script but it is not working properly . Can anyone please help me.
And my UI action:
Thanks in advance
cc:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(value == ''){
var items = $$('CareAR Instruct').each(function(item){
if(item.innerHTML.indexOf('CareAR Instruct') > -1){
item.hide();
}
});
}
else if(value != ''){
var model = $$('CareAR Instruct').each(function(item){
if(item.innerHTML.indexOf('CareAR Instruct') > -1){
item.show();
}
});
}
//Type appropriate comment here, and begin script below
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2022 07:37 AM
Hi,
update as this -> give label of that button
I hope you have done this already
please make Isolate Script as False for your Client Script
If this field is not on form then from list make it false
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var val = g_form.getValue('x_care3_carear_fsm_instruct_experience');
if (val != '') {
var items = $$('BUTTON').each(function(item) {
if (item.innerHTML.indexOf('CarearInstructButton') > -1) {
item.show();
}
});
}
else {
var itemss = $$('BUTTON').each(function(item) {
if (item.innerHTML.indexOf('CarearInstructButton') > -1) {
item.hide();
}
});
}
//Type appropriate comment here, and begin script below
}
regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2022 12:12 AM
Hi
I have done as said by you . But still I am not getting expected result . Can you please check onChange client script code .
Thanks in advance
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var val = g_form.getValue('x_care3_carear_fsm_instruct_experience');
if (val != '') {
var items = $$('BUTTON').each(function(item) {
if (item.innerHTML.indexOf('carear_instruct') > -1) {
item.show();
}
});
}
else {
var itemss = $$('BUTTON').each(function(item) {
if (item.innerHTML.indexOf('carear_instruct') > -1) {
item.hide();
}
});
}
//Type appropriate comment here, and begin script below
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2022 07:37 AM
Hi,
update as this -> give label of that button
I hope you have done this already
please make Isolate Script as False for your Client Script
If this field is not on form then from list make it false
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var val = g_form.getValue('x_care3_carear_fsm_instruct_experience');
if (val != '') {
var items = $$('BUTTON').each(function(item) {
if (item.innerHTML.indexOf('CarearInstructButton') > -1) {
item.show();
}
});
}
else {
var itemss = $$('BUTTON').each(function(item) {
if (item.innerHTML.indexOf('CarearInstructButton') > -1) {
item.hide();
}
});
}
//Type appropriate comment here, and begin script below
}
regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2022 06:29 AM
Hello,
If you are fine with my response, Please hit like and mark my response as correct if that helps.
Regards
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2022 06:32 AM
Raghav
MVP 2023