- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 12:59 PM
I have a need to create an alert on a variable at the SCTASK level/table. Need the alert to display below the requested for variable.
I can get the alert to display on the form but cannot figure out what I am doing wrong that it will not display below the requested for variable:
I've created a display business rule using variations of g_form.showFieldMsg
g_form.showFieldMsg("current.requested_for", "This is the error message", "error");
This works
gs.addErrorMessage('This is the error message');
but I need the alert message to appear below the requested for variable.
Is my field name incorrect on the showFieldMsg statement?
Any help is appreciated.
Thank you,
Rachel
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 01:56 PM
Hi,
You can still do this in the catalog client script. In this scenario, you could use a getReference callback function on the user field such as:
var user = g_form.getReference('variables.requested_for', callBack);
function callBack(user) {
if (user.u_vip_field) {
g_form.showFieldMsg("variables.requested_for", "This is the error message", "error");
}
Something similar along those lines and again, check for variables.requested_for and requested_for. Then replace field names as appropriate to include the custom vip field you made as well.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 07:48 AM - edited 03-07-2023 07:49 AM
Hi,
You can try adjusting this line:
if (user.u_legal_hold) {
to this instead
if (user.u_legal_hold == 'true') {
It should have worked the way I provided it before, but perhaps the value you're getting isn't a boolean typeof. Without going down a rabbit hole of troubleshooting, etc. try the above adjustment.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 07:42 AM
Good morning Allen,
I just realized that the showFieldMsg is displaying for all users and not users that are flagged.
This is the script:
function onLoad() {
//Type appropriate comment here, and begin script below
var user = g_form.getReference('variables.requested_for', callBack);
function callBack(user) {
if (user.u_legal_hold) {
g_form.showFieldMsg("variables.requested_for", "This customer is on Legal Hold.", "error");
}
}
}
On the user record I have a check box - legal hold - if that is checked, then the message should display.
What change(s) is needed for this to only display if that box is checked or true?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 07:48 AM - edited 03-07-2023 07:49 AM
Hi,
You can try adjusting this line:
if (user.u_legal_hold) {
to this instead
if (user.u_legal_hold == 'true') {
It should have worked the way I provided it before, but perhaps the value you're getting isn't a boolean typeof. Without going down a rabbit hole of troubleshooting, etc. try the above adjustment.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!