The Now Platform® Washington DC release is live. Watch now!
‎09-24-2017 11:14 PM
Hi,
What is the difference between client script and business rule apart from the one that client script runs on the form and business rules on the database. Suppose I have a business rule which prints a message when one field in the form is empty and I have a client script that does the same thing. How do I come to know whether it is the Business rule or the client script that worked.
Thanks in advance
Sruthi
‎09-24-2017 11:18 PM
Hello Sruthi,
If the message is displayed during form load or on change of any field then it is a client-side operation or can be a Display BR. However, if the message is shown after the form is submitted then it can be onSubmit client script or business rule.
‎09-24-2017 11:22 PM
Hi Sruthi,
client script executed on client browser, it included onload, onsubmit, onchange, oncellEdit.
Business rule is server side scripting used to perform the operation on server, its having the types 1)before 2) after
executed at the time of 1) display or query 2) insert 3) update 4)delete
@serch with wiki on more, if you need any help ask me
Regards
Venkat
‎09-24-2017 11:23 PM
Hello Sruthi,
I hope this helpful to you,
The major difference between of them client script always runs on clisnt side browser and Business Rule always runs on server side when a record inserted/updated/deleted/queried from data base.
Client-based code:
"Client-based code that executes in the browser, using Ajax or running as Javascript, always executes before the form submission to the server."
This includes Client scripts and UI Policies.
First onLoad Client scripts, after that the first UI Policies kick in.
After that, the Client scripts and UI Policies that work onChange.
After that, the Client scripts that work onSubmit.
Server-side code: (More info: Execution Order of Scripts and Engines)
Most scripts have a name and specify a table.
The most important differences among scripts are
The web browser is the client, and is often the only software that is installed at the customer site.The application server and the database are located at the data center.
The web browser is where you control and communicate with an instance, including communicating with the server and database.
Note: When you are writing scripts, you cannot use reserved words. |
Choose the module name for further information.
Script | Function | Runs on |
http://wiki.servicenow.com/index.php?title=Using_Access_Control_Rules | ||
Business Rules | Customizes system behavior
| server - script and any condition run on the server |
Client Scripts | Used for making changes to the appearance of forms, displaying different fields based on values that are entered or other custom display options.
| client |
‎09-24-2017 11:27 PM
now coming to your questions,
business rule which prints a message when one field in the form is empty and I have a client script that does the same thing. How do I come to know whether it is the Business rule or the client script that worked.
Ans : The server side query or display business rule runs first. That is during load of the record from the server side. Then client side scripts will pick up. Then, before and after business rules.