Default value field

Hi community
i would like to know if possible instead of getting Today date value as default value get Yesterday i tried
frappe.datetime.add_days(Today, -1) not working

any help


I think, you can get the date from yesterday with this inline script.
frappe.datetime.add_days(frappe.datetime.nowdate(), -1);


@iRaySpace not working if i make it in field type data does nothing and if date gives error


Can you provide any existing codes of what you have done so far?

I tried the same think in default field but not working for me eather custom script worked


Can you please give us the code to your custom script so that we can help you debug the script? Aside from that, can you check if your browser’s console is showing an error and post the traceback here? Thanks!

cur_frm.cscript.custom_title = function(doc, cdt, cd){
cur_frm.set_value(“title”, frappe.datetime.add_days(frappe.datetime.nowdate(), -1));
cur_frm.set_value(“date”, frappe.datetime.add_days(frappe.datetime.nowdate(), -1));

@solosoft, i think you might need to add the following :



1 Like

THANK YOU SO MUCH @littlehera

No problem, @SOLOSOFT, and you’re welcome! :slight_smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.