Server-side equivalent to g_scratchpad?

Michael Domke
Tera Guru

Is there a server-side equivalent to g_scratchpad?

What I'm try to accomplish is to build a List Choice UI Action that runs on the server (client not checked). I want to retain a unique identifier that will be used for each record that is checked to be processed.

For example, say I select four records in a list and choose my UI Action from the list choices. When the first record is processed I want to create a unique identifier and then use that unique identifier when all records are processed.

Any ideas or alternatives?

Michael

5 REPLIES 5

CapaJC
ServiceNow Employee
ServiceNow Employee

You should be able to set a global variable that will persist for the duration of the transaction. Then just check for its existence before setting or using it.

e.g.,



if (typeof g_my_temporary_unique_global_variable_name == "undefined")
g_my_temporary_unique_global_variable_name = "some value I want to use";

current.u_custom_field = g_my_temporary_unique_global_variable_name;


Thanks for the quick reply.

I just tried this but I get an error ""g_my_temporary_unique_global_variable_name" is not defined". is there some additional initialization required?


Never mind, my mistake. I inadvertently left out your instruction to test for the global property's existence before using it.


CapaJC
ServiceNow Employee
ServiceNow Employee

Strange, I don't get that. Are you sure you have the "typeof" bit of the IF statement in there? That's what protects against it not yet being defined...