- 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-06-2023 01:06 PM - edited ‎03-06-2023 01:06 PM
Hi,
You should be able to create an onLoad catalog client script and check the box for it to only apply on the task record.
Then in the script, you'd use something like:
g_form.showFieldMsg("variables.requested_for", "This is the error message", "error");
I'm unsure if variables.requested_for will work and normally we'd use requested_for, but if you have that field on your form already, it may apply it to the actual table field, versus the variable. Try both ways and see how it works for you.
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-06-2023 01:26 PM
Hi Allen,
Thank you for the information which works however I have a condition as part of this need which is why I went the business rule path. Sorry that I did not mention that in my initial post.
We have a need to track customers that are directorate administrators. (They are similar to a VIP). I added a check box to the user table - the condition is if directorate administrator is true, then display this alert.
The requested for variable is part of a variable set that is included in every catalog item - just not sure of the if/else statement to accomplish this. (The business rule filter let me accomplish that it just didn't show the alert 😞
Can this be accomplished in a catalog client script?

- 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-06-2023 02:04 PM
Thank you so much for the help - so very much appreciated.