Client scripts (previously Custom scripts) vs. Form scripts

Hi, I’m a new Frappe user and I’m trying to understand the differences between (custom) client scripts and form scripts. Especially w.r.t deploying and updating.

I think some of the difference has to do with custom doctypes, since they don’t get their own files in the /app directory and must instead use the database to store field definitions (and scripts, i suppose) as described in the linked post.

So AFAICT, Client scripts are a part of a site and Form scripts are part of an app, similar to how custom doctypes are described above.

Therefore, if you deploy an app this won’t include client scripts. Also, if you manually amend a form script (on a deployed app) on a site, then those changes would be overwritten when the app itself is updated.

Is the above correct, and have I missed other differences?

1 Like

Hi:

Form scripts and client scripts are the same thing. This will run on the “client” side of the app: the form or list view.

Note that client & server scripts are the proper way to customize existing doctypes (i.e. erpnext customer doctype). You could edit the code (.js and .py files) but this changes will dissapear after updating apps.

When you create a script (client or server script) this will be stored on the database (data), so it will remain even after updating app. To “packing” the scripts into the app, you need export them as fixtures by including on hooks.py file . This way, the scripts will be included when you install the app in another site. Fixtures can be used to export other database data: custom fields, reports, translations, etc …

Take a look here:

Hope this helps.

1 Like

Thank you, this helps a lot.