g_scratchpad

AnjuShri
Mega Contributor

please explain g_scratchpad with the help of some code snippet.

1 ACCEPTED SOLUTION

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,


g_scratchpad is a temporary variable to pass server side values to client side if client need server data. Display business rule is used to initialize scratchpad and make it available to client script.


Ex: if you want caller information then we use it in below manner.

 

Business rule:

 

(function executeRule(current, previous /*null when async*/) {
g_scratchpad.email= current.caller.email;
g_scratchpad.phone= current.caller.phone;
})(current, previous);

 

Client Script :

function onLoad()

{

g_form.setValue('email',g_scratchpad.email);

g_form.setValue('email',g_scratchpad.phone);

 

Let me know if you need any info.


Thanks,

Ashutosh Munot

 

View solution in original post

7 REPLIES 7

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,


g_scratchpad is a temporary variable to pass server side values to client side if client need server data. Display business rule is used to initialize scratchpad and make it available to client script.


Ex: if you want caller information then we use it in below manner.

 

Business rule:

 

(function executeRule(current, previous /*null when async*/) {
g_scratchpad.email= current.caller.email;
g_scratchpad.phone= current.caller.phone;
})(current, previous);

 

Client Script :

function onLoad()

{

g_form.setValue('email',g_scratchpad.email);

g_form.setValue('email',g_scratchpad.phone);

 

Let me know if you need any info.


Thanks,

Ashutosh Munot

 

Hi Ashutosh,

 

What is the scope of the g_scratchpad variables?

Can I use the g_scratchpad values assigned by a query/display Business Rule on Table say 'A' in the Client Script on another Table say 'B' ?

Or it is limited to the same table?

 

Thanks and Regards,
Santhosh

 

 

It is limited to the same table.

How to autopopulate same user mail id in mail field