Client Script - Alert Message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2018 02:21 AM
I am trying to create a client script to display an alert message on the REQ and INC forms based on a particular form field.
For some reason the alerts does not show when the if statements is included but I am rather new to client scripts so I am bound to have done it wrong.
Can anyone shed any light on why this doesnt display?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2018 02:27 AM
I presume the issue is with if condition.
you can use below code and check what is value that is being stored in service
function onLoad(){
var service = g_form.getValue('u_service_level');
alert(service);
}
and check if the alert value matches with the value mentioned in the if condition.
Please like, mark helpful/correct based on the impact of the response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2018 03:54 AM
Thanks, that has definitley highlighted the issue as the message appears but displays no value.
Would this be beacuse the u_service_level filed is actually on the company table and this client script is, for the momentm, only on the Request table. Do I need to somehow reference the company table before the field name?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2018 02:27 AM
Hi Richard,
Try to add g_form.addInfoMessage(service) between line 2 and 3. This will pop up the value of service so you can see wether the correct value is obatined by the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2018 04:01 AM
The client script is onload type client script
I presume that while loading the form the value of u_service_level filed is blank that is why the condition never satisfies.
Change the type of client script to on change and select u_service_level in the filed name and check.
Please like or mark correct/Helpful based on the impact of the response.