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.
Home > Customization > Form Customization > Custom Script
1. How to Create a Custom Script
Create a Custom Script (you must have System Manager role for this):
- Go to Custom Script List and click on New.
- You will be redirected to a page wherein you will be asked to enter the DocType for which you wish to create a Custom Script.
- Type your Custom Script.
- Save.
2. Notes
- Server Custom Scripts are only available for the Administrator.
- Client Custom Scripts are in JavaScript and Server Custom Scripts are in Python.
- 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:
- Fetch Values From Master
- Date Validation
- Generate Item Code Based On Custom Logic
- Make Read Only After Saving
- Restrict Cancel Rights
- Restrict Purpose Of Stock Entry
- Restrict User Based On Child Record
- Sales Invoice Id Based On Sales Order Id
- Update Date Field Based On Value In Other Date Field
- Custom Button
- Filter Options In Select Field
- Fetch Value In Child Table Field
- Hide Buttons In Form View
- Rename Buttons In Form View
- Lock Timesheets Based On Date