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

johnfeist
Mega Sage

Hi Michelle,

I wrote a simple client script to try and find your issue:

function onLoad() {
   //Type appropriate comment here, and begin script below
   var theValue = g_form.getValue("source_table");
	if (theValue == "change_request") {
		g_form.addInfoMessage("Value is " + theValue + " this is the true path");
	}
	else {
		g_form.addInfoMessage("Value is " + theValue + " this is the FALSE path");
	}
}

When I run it I always get the if message rather than the else meaning that it is getting change_request as the source_table.  I'd suggest that you make sure that you have the removeOption() arguments correct.  There is no OOTB information option for state in sysapproval_approver.

Hope that helps.

:{)

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

Hope that helps.

:{)

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

Hi @johnfeist thanks for the code, I should have mentioned earlier that I created a custom State  option called "information". 

when I run it gives me the Else statement "Value is this is the FALSE path"

Hi Michelle,

I suspected that you had created the option.  When you run the script that shows the FALSE path, what is it showing for the table name?

:{)

Hope that helps.

:{)

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

It doesn't seem to populate anything for the table name. It seems to act like a reference variable, but it is not labeled as such.

find_real_file.png