Purpose of permission query in server script and how to use this?

Explain how to set a permission query?

Hi @harivignesh:

Let’s say you want to restrict customer docytpe on territory value …

Your script

# Here your logic to get the desired territory
# could be more complex ;)
territory_to_filter = 'Cuba' 

conditions = f'territory = {territory_to_filter}'

With this simple script conditions are being applied dinamically to the doctype.
Hope this helps.

Thanks @avc. Is there anyway to achieve the same through back end side? I mean without server script doctype , possible to do in backend side