g_scratchpad not working as expected
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 05:48 AM - edited 11-28-2023 05:59 AM
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
Client script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 06:34 AM
share the client script, it should work fine ideally, why don't you use parseBool
use below line in display BR
g_scratchpad.vipslt = parseBool(gr.getValue("u_vip_slt'));
and in onload client script use
if(g_scratchpad.vipslt == "true")
g_form.showFieldMsg("requested_for", "your message", "info");
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 06:22 AM - edited 11-28-2023 06:23 AM
This should work, here is what I tried, you can compare and correct. Your client script should be onload and not onchange
Also in your BR you are using gs.getUserID(), which is not right, you should use current.requested_for instead as you are fetching the flag for requested for and not the logged in user.
BR
Client SCript
Result
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2023 01:33 AM
Hi @Anurag8 and @Aman Kumar S
I am still stuck with the same issue. i tried everything you both suggested but still no luck.
BR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 05:55 AM
On your display BR you are setting g_scratchpad.slt (on line 3) and then on the next line and also the client scrit yiou are trying to use g_scratchpad.vipslt
You are using wrong Variable name. change line 3 to use g_scratchpad.vipslt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 06:13 AM
Hi @Sarabjeet1,
Your display BR and Client scripts should be on RITM table.
If my response helps you resolve your issue. Kindly mark it as helpful & correct. It will be helpful to future readers! 👍🏻
Thanks,
Sagar Pagar