"g_scratchpad is not defined" when calling ui action (scoped)

Zod
Giga Guru

Hi all,

having a strange log entry that I can't understand & avoid.

I'm using a (scoped) on before display business rule to set a g_scratchpad to true/false to use it for a (scoped) ui action as condition.

All works fine and as it should.

Scratchpad is set as expected and UI action only visible is g_scratchpad is true (by default the g_scratchpad is set to false via the business rule.

Just one thing is strange .. the ui action will perform a serverside change on the record after which  the UI action is not to be visible anymore (and it isn't) as the g_scratchpad will be false after using the ui action .. all ok ... just  a log will show up saying:

find_real_file.png

I mean this is no issue .. as all works fine, just I'd like to avoid this messages .. 

Thank you!

9 REPLIES 9

See OOB ui action.

The issue looks more like I have not set the client check .. and ONLY perform server side ... got to check this ...

find_real_file.png

Service_RNow
Mega Sage

Hi,


Check this website. Maybe you will find some interesting information.

https://servicenowgems.com/2016/10/10/understanding-scratchpad-g_scratchpad/

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

FIKRI BENBRAHIM
Kilo Guru

Hello,

 

g_scratchpad can only be used in business rules that are on display, otherwise it wouldn't be filled.

See those link for details: https://www.oreilly.com/library/view/learning-servicenow/9781785883323/cb4b394d-3406-450d-a6e0-9bdb0...  and  https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/app-store/good_practices/client_s....

Mark it helpful or correct if it helps you.

 

Cheers

"g_scratchpad can only be used in business rules that are on display, otherwise it wouldn't be filled."

-- used?? They are set within the BR for performance reasons .. but the can and should be used outside the BR.

See OOB UI action .. 

find_real_file.png

in this example they get the data from g_scratchpad that was already filled somewhere on the server side. Thats why they used the GlideSystem .nil (gs.ni) in order to verify if it already had been filled in the server side.

NB: This global variable get filled in the server side (Business rules, script includes,...) and consummed in the client side (ui action, client script...).

So, before judging the behavior of a scratchpad variable you should consider if you are in client/server side.