Hi everyone,
I’m working on customizing the
Event creation flow inside the Opportunity doctype. Under the Activities tab, when I click “New Event”, I want the “Public” checkbox to be automatically checked.
My use case:
- The Event is being created from inside the Opportunity screen (reference_type = “Opportunity”)
- I want the “Public” checkbox to be checks Always
Is there a clean way to achieve this using Client Script?
I’ve tried the following script on the Event doctype:
frappe.ui.form.on('Event', {
onload: function(frm) {
if (frm.is_new() && frm.doc.reference_type === 'Opportunity') {
frm.set_value('public', 1);
}
}
});
Is this the correct approach? Or is there a better hook I should use?
Thanks in advance!