I set the Standard Filter Values
When I make a new record for the Doctype, I want to copy the values I set at the Standard filter as the default values for the new record.
Any idea on how to do this?
Use a custom script for this. Elaborate your use case, share screenshots of the exact doctypes, fields etc
I set two standard filters: Statement Date and Period
I click Add Property Monthly Rental
I want the Statement Date: May 5, 2021 and Period June 1, 2021 values of the Standard Filter copied to the new record of Property Monthly Rental, so that I only have to type one more field: Property Lease.
Ok. I solved this. Share the code here, just in case you have use cases where you want to copy the standard filter as default values of new record:
onload: function (frm) {
if (frm.doc.__islocal) {
let curfilters = cur_list.filters
for (let vi = 0; vi < curfilters.length; vi++) {
let curfilter = curfilters[vi]
if (curfilter[2] === '=') {
frm.doc[curfilter[1]] = curfilter[3]
}
}
}
}