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

Ajaykumar1
Tera Guru

Hi AnjuShri,

Refer the link : Example - retrieve server data using g_scratchpad

Regards,
Ajay

SaiRaviKiran Ak
Giga Guru

Hi,

 

Below link could help you out:

g_scratchpad functionality and its use

 

Thanks,

Ravi

Priyanka136
Mega Guru

Hi AnjuShri,

g_scratchpad Object passes the information from server to the client, when the client requires information which are not available on the form.

Refer this link which will help to understand the basic concept :-

https://community.servicenow.com/community?id=community_question&sys_id=e287c3a9db1cdbc01dcaf3231f96...

https://community.servicenow.com/community?id=community_question&sys_id=05c19f6ddbdcdbc01dcaf3231f96...

Please mark it Correct or Helpful, if it works based on impact....!!!!

Warm Regards,

Priyanka

find_real_file.png

www.dxsherpa.com