g_scratchpad underined error

Dwain Bryden
Tera Contributor

Hi Guys,

I have a display business rule that I am calling from a client script. When calling using g_scratchpad I am getting a "undefined" error when trying to retrieve the value of the field.

I know i am missing something really small please see below:

Display Business Rule:

find_real_file.png

Onload Client Script:

find_real_file.png

Error:

find_real_file.png

 

 

 

1 ACCEPTED SOLUTION

Jim Coyne
Kilo Patron

Any update on this question?  Were you able to resolve the issue?

View solution in original post

14 REPLIES 14

Allen Andreas
Administrator
Administrator

The tables have to be the same for the display BR and the record. Is the table for the BR on incident?

Also if that doesn't work, I would swap out:

user.get from BR and just do

user.addQuery('user_name', gs.getUserID());
user.query();

Or try

var user = gs.getUserID();
g_sctrachpad.source = user.getValue('source)';

 

ORRRRR

 

In your first screenshot the ; is a space away too far after the source getValue, could move it back one.

 

And in your client script you're missing your brackets after if {

then closing before } else then again reopening {

and a final close }

 

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi Allen, 

Yes both are on the Incident Table.

Great, see my other comments in that same post. 🙂


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Just wanna update this thread so that other users should not get confused. 

Q: Or try

var user = gs.getUserID();
g_sctrachpad.source = user.getValue('source)'; 

A: gs.getUserID(); will output a string, not the Glide Object. So it wont work. 

 

Q: In your first screenshot the ; is a space away too far after the source getValue, could move it back one.

A: it doesnt matter for the compiler. 

 

Q:And in your client script you're missing your brackets after if {

then closing before } else then again reopening {

and a final close }

A: It doent matter for the compiler, if you have multiple lines under your loop (if/else/for/while etc etc) then you must wrap them in braces. Or else wrapping them in braces is optional.