Client Scripts

Client Scripts are small code snippets that are executed in the browser to extend or customize the standard functionality of ERPNext.

Home > Customization > Custom Script

Client Script

1. How to Create a Custom Script

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

  1. Go to Custom Script List and click on New.
  2. 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.
  3. Type your Custom Script and make sure it is enabled.
  4. 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. Client 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 On Other Date Field
  10. Add Custom Button
  11. Filter Options In Select Field
  12. Fetch Value In Child Table Field
  13. Hide Buttons In Form View
  14. Rename Buttons In Form View
  15. Lock Timesheets Based On Date

3. Videos