adding a message to the top of the from

brown9394
Tera Expert

Hello Experts,

I have a client script that checks if the record is new and executes a message on top of the screen for users. How do I extend this client script to show the same message after submit (record is still in the same 'draft' state after submit) if it's not 'New'?

function onLoad() {

        if (g_form.isNewRecord()) {

                  g_form.addInfoMessage('User message here.');

        }

}

11 REPLIES 11

This will work. But James wanted it after submit.


Geoffrey2
ServiceNow Employee
ServiceNow Employee

I assume by "after submit" you mean after the form is submitted and reloads?



You could used an onLoad Client Script or a display Business Rule.   Assuming the value of your Draft state is 1:



onLoad Client Script:


function onLoad() {  


      if (g_form.getValue('state') == '1')


              g_form.addInfoMessage('User message here.');


}



Business Rule:


Advanced: true


When: display


Condition: current.state == 1


Script:


gs.addInfoMessage('User message here.');