Update Date Field Based On Value In Other Date Field

The script given below would auto-set value for the date field, based on the value in another date field.

Example: Production Due Date must be set as two days before Delivery Date. Let us assume that the Delivery Date for a project has already been defined, and there is a Field 'Production Due Date' as a 'Date' field type present already in the form. Applying the following script shall ensure that the Production Due Date gets auto updated to two days prior to the delievry date.


cur\_frm.cscript.custom\_delivery\_date = function(doc, cdt, cd){
 cur\_frm.set\_value("production\_due\_date", frappe.datetime.add\_days(doc.delivery\_date, -2));
 }

  1. Field Types
Discard
Save
This page has been updated since your last edit. Your draft may contain outdated content. Load Latest Version

On this page

Review Changes ← Back to Content
Message Status Space Raised By Last update on