The CreatorCon Call for Content is officially open! Get started here.

Variable Table Name - client script

Michelle89
Tera Contributor

I am configuring a client script and trying to get the value that is set in the field "source_table" which is Type: Table Name. I was looking for more information on the variable Type: Table Name, but nothing stood out to me. Can anyone help point me in the right direction so that my 'getValue' pulls the data? Thanks in advance!

 

find_real_file.png

 

function onLoad() {
           var abc = g_form.getValue('source_table');
	   if (abc == 'change_request'){
      g_form.removeOption(‘state’,‘information’);
   }
}
1 ACCEPTED SOLUTION

Mike Patel
Tera Sage

If you don't have that field on form then you will not be able to get value of it in client script.

Make sure source table field is on form.

View solution in original post

10 REPLIES 10

Hi Michelle,

Can you please include the script that you are running as well as a more complete screen print.

:{)

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

Hi,

did you check what alert it gives for the value

function onLoad() {
           var abc = g_form.getValue('source_table');
alert(abc);
	   if (abc == 'change_request'){
      g_form.removeOption(‘state’,‘information’);
   }
}

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

It doesn't seem to pull a value at all.

Mike Patel
Tera Sage

try adding toString()

function onLoad() {
           var abc = g_form.getValue('source_table').toString();
	   if (abc == 'change_request'){
      g_form.removeOption(‘state’,‘information’);
   }
}

Mike Patel
Tera Sage

If you don't have that field on form then you will not be able to get value of it in client script.

Make sure source table field is on form.