g_scratchpad not working as expected

Sarabjeet1
Tera Contributor

Hi,

I have a simple requirement to show field message if user is SLT true. I have used Display BR to get the value from user table and called that in my client script. g_scratchpad is passing undefined value to CS (checked with alert). Not sure if i am making any syntax mistake or something else. Please find below both and let me know what i am doing wrong.

Display BR 

Sarabjeet1_0-1701179920602.png

 

 

Client script

Sarabjeet1_1-1701179167814.png

 

 

 

 

14 REPLIES 14

Aman Kumar S
Kilo Patron

Hi @Sarabjeet1 

The scratchpad variable in BR is g_scratchpad.slt but in client you have user g_scratchpad.vipslt

 

The names should match for it to work

Best Regards
Aman Kumar

Hi Aman,

 

Thanks for your response. I corrected it and then also it is not working as expected.

 

Your Display BR is on user table and client script is on ritm, change the BR to run on RITM as well.

And in the script you will have to dot walk, like current.requested_for.u_vip_slt, something like this

-Anurag

Hi Anurag,

Thank you for pointing this. Now i changed the table to sc_req_item and used the below mentioned script. But still showfieldmessage() is not showing the required message.

(function executeRule(current, previous /*null when async*/ ) {

    var gr = new GlideRecord('sys_user');
    gr.get(gs.getUserID());
    g_scratchpad.vipslt = gr.u_vip_slt;
    gs.log('sarab' + g_scratchpad.vipslt);

})(current, previous);