Client Script - Alert Message

Richard T
Kilo Guru

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?

alert.PNG

4 REPLIES 4

Siddartha Gudim
Tera Guru

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.


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?


einvaldserigsta
Kilo Sage

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.


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.