> For the complete documentation index, see [llms.txt](https://docs.obto.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.obto.co/applications/server-policies.md).

# Server Policies

How to create a Server Policy: -&#x20;

A server policy is a piece of code that gets executed before or after when some data gets created / updated / deleted / queried in collection.&#x20;

In order to create a Server Policy, follow these steps: -&#x20;

1. On navigation, under Policies go to Server Policies. You will see a list of all the server policies if any.&#x20;
2. Click on ‘settings icon’ on top left corner and then click ‘new’.&#x20;
3. A form appears where you have to provide the following details: -&#x20;
4. Name - name of the server policy.&#x20;
5. Collection – name of the collection, server policy gets executed when data is saved in this      collection.&#x20;
6. Active – Check / Uncheck if ready / not ready to used.&#x20;
7. Execution Time: -&#x20;
8. PRE – Execute before the data gets created / updated / deleted / queried.&#x20;
9. POST– Execute after the data gets created / updated / deleted / queried.&#x20;
10. Action: -&#x20;
11. Create - Executed when data gets created.&#x20;
12. Update - Executed when data gets updated.&#x20;
13. Delete - Executed when data gets deleted.&#x20;
14. Query - Executed when data gets queried.&#x20;
15. Order – In what order to execute the server policy.&#x20;
16. Script – The code for doing operations(logic).&#x20;
