If both client script and business rule are applied on a table, which one will get executed first?

Giri6
Tera Expert

I read the answer as a business rule first. I feel it does not makes sense unless we know the context. I want to make sure this is right.

For example, if I query for the incident, these are things happens in the order

1. Before query business rule 2. After query business rule  3 After page loads onload() and other client scripts.

So if business rules displays a message, it should display the message from before query, the message from after query, alert from onload

For the second scenario after the submission of the update of a record

1. onsubmit() from client script 2. Before update of business rule 3. After update of business rule

Is it correct? So the answer could be

1. First business rule and then client scritp code  IN THE CASE OF  DISPLAYING RECORD

2. First client script and then business rule IN THE CASE OF UPDATE OF RECORD.

Let me know if you agree. Appreciate it.

 

3 REPLIES 3

Jaspal Singh
Mega Patron
Mega Patron

Yes Giri your understanding for both the scenarios are correct.

Only thing would like to update is there isn't anything as After Query Business rule its only Before Query business rule whilst rest of your understanding is correct.

Santhana Rajhan
Mega Sage

Generally, in most cases Client scripts happen on client, there is no request or response to the server

Business Rules run on the server side:

find_real_file.png

Alok Das
Tera Guru

Hi Giri,

Want to add 2 points, one was already added by Jaspal, There is no After Query business rule. You fill find the option to create one but that doesn't make any sense because records are already queried and displayed in the list.

Second one is Display Business Rule which was missed and which get's executed when user requests a form record, so just before onLoad client script executes, Display business rule gets executed. To know more about Display business rule you can navigate to the below link:

https://docs.servicenow.com/bundle/orlando-application-development/page/script/business-rules/concep...

Hope it helps...!

Regards,

Alok