
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2019 01:17 PM
Hey SN Comm,
I am looking to throw a little field message right under Assignment Group (just for our Employee Relations COE).
I was thinking of doing an onLoad client script - with conditions...
IF Assignment Group field is empty, show message
IF Assignment Group is NOT empty, hide message
Any suggestions on how to accomplish? Is onLoad Client Script the best way to do this? If not, what would be better?
Maybe a UI message box that the user can click OK / Cancel to in order to dismiss the message..?
Thanks in advance!
-Rob
What I did so far with an onLoad: (is this the right path?)
function onLoad(){
if('assignment_group','==',"");
g_form.showFieldMsg('assignment_group','Be sure to select Assignment Group first, then select the Assigned To person','info');
g_form.showFieldMsg('assignment_group','Employee Relation Teams are as follows: HR Employee Relations Level 1, HR Employee Relations Level 2, HR Employee Relations Level 3','info');
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2019 02:14 PM
Hey Rob S.
It's best practice to avoid Client scripts that run when the form loads. You can use a Display Business Rule instead since it avoids the browser having to parse and work with the form right when the user is waiting for it to display. This becomes more true the more fields you have on your form. However, if you're not having any efficiency issues, there's not necessarily a problem with using an Onload Client script. If you go with this option, make sure you use the g_form.hideFieldMsg('<field_name>') as the FIRST method you run if you're going to be using info messages. This will clear any lingering messages if the end user decides to refresh the page.
In this case though, I would go ahead and use a Display Business rule and just set the condition field as follows:
'assignment_group - is empty'
This way, the business rule runs and shows your message when this condition is true. From there, you just have to script the message:
go to the 'actions' tab and just write your message. No scripting required!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2019 01:21 PM
you are going in correct path to use showFieldMsg() method for showing message below field.
Regards,
sAchin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2019 02:47 PM
Thanks Sachin!
-Rob

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2019 02:14 PM
Hey Rob S.
It's best practice to avoid Client scripts that run when the form loads. You can use a Display Business Rule instead since it avoids the browser having to parse and work with the form right when the user is waiting for it to display. This becomes more true the more fields you have on your form. However, if you're not having any efficiency issues, there's not necessarily a problem with using an Onload Client script. If you go with this option, make sure you use the g_form.hideFieldMsg('<field_name>') as the FIRST method you run if you're going to be using info messages. This will clear any lingering messages if the end user decides to refresh the page.
In this case though, I would go ahead and use a Display Business rule and just set the condition field as follows:
'assignment_group - is empty'
This way, the business rule runs and shows your message when this condition is true. From there, you just have to script the message:
go to the 'actions' tab and just write your message. No scripting required!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2019 02:46 PM
Thanks for your reply US_3_R - I actually thought about doing it the BR way first, same conditions as you mentioned in your suggestion. However, No message shows up anywhere when the form loads, with the assignment group field being empty.
That was why I went to the Client Script way. I am not really sure as to why my message from the BR is not loading, it's very strange.
-Rob