Custom Scripts

If you wish to change any ERPNext form formats, you can do so by using Custom Scripts. For example, if you wish to add a submit button after saving, to a Lead form, you can do so by creating your own script.

Setup > Customization > Custom Script

Custom Script

1. How to Create a Custom Script

Create a Custom Script (you must have System Manager role for this):

  1. Got to: Setup > Custom Script > New Custom Script
  2. Select the DocType in which you want to add the Custom Script

Notes

  1. Server Custom Scripts are only available for the Administrator.
  2. Client Custom Scripts are in JavaScript and Server Custom Scripts are in Python.
  3. For testing, make sure to go to Tools > Clear Cache and refresh after updating a Custom Script.

2. Custom Script Examples

Here are some custom script examples:

  1. Fetch Values From Master
  2. Date Validation
  3. Generate Item Code Based On Custom Logic
  4. Make Read Only After Saving
  5. Restrict Cancel Rights
  6. Restrict Purpose Of Stock Entry
  7. Restrict User Based On Child Record
  8. Sales Invoice Id Based On Sales Order Id
  9. Update Date Field Based On Value In Other Date Field
  10. Custom Button
  11. Filter Options In Select Field
  12. Fetch Value In Child Table Field
  13. Hide Buttons In Form View
  14. Lock Timesheets Based On Date