g_form.getUniqueValue is not a function error when trying to use in UI Action on scoped app

Marcia L
Tera Contributor

I have a UI Action in which I am trying to download attachments via a button on the list view.  in my client side script, I am using g_form.getUniqueValue to grab the sys_id but it's throwing an error that it is 'not a function'.  Screen shots below of the scripts and error.  

 

MarciaL_0-1699449787873.png

 

MarciaL_1-1699449812282.pngMarciaL_2-1699449822338.pngMarciaL_3-1699449830846.png

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Marcia L 

on list banner button g_form is not defined as it's a list and not form

make these changes

1) Script include line 10

gr.addQuery('table_sys_id', 'IN', tblSysId);

2) UI action line 7 use this instead of g_form.getUniqueValue()

g_list.getChecked()

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Marcia L 

on list banner button g_form is not defined as it's a list and not form

make these changes

1) Script include line 10

gr.addQuery('table_sys_id', 'IN', tblSysId);

2) UI action line 7 use this instead of g_form.getUniqueValue()

g_list.getChecked()

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Marcia L
Tera Contributor

That worked!  Thank you so much