g_form.getTableName() is not working when I need to use it as condition in Client Script.

Gpope
Tera Contributor

Hi All! 

 

I'm facing this issue : 

 

On TASK table there is one Client script : Assignment Group onChange, it is clearing the Assigned To Value. 

The issue is that Im trying to restrict this for an specific table using : 

 

if (g_form.getTableName() != 'my_specific_table'{
}
 
This condition is not working, and the client script is running for my table anyways. I already tried doing an alert showing 
g_form.getTableName() and it works, shows the correct table. 
 
 
Note : I also tried scratchpad with current.getTableName() and g_list.getTableName(). 
 
Do you know what can be happening and how can i fix this ? 
 
Thanks ! 
3 REPLIES 3

Bert_c1
Kilo Patron

You must have some other problem, 'g_form.getTableName()' worked in my Client script', returns the name value of the table. Don't use the label value.

Community Alums
Not applicable

Please try this 

if (g_form.getTableName() != 'my_specific_table'){
}
Regards
Suman P.

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

Don't see immediately an issue with this. Can you share more of your code? Or are you sure the issue is not in something else of your code?

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn