Auto Share Document on Create

Hello,

I want to auto-share ToDo with the specific users while creating it.

I have tried custom script but, it is not working.

frappe.ui.form.on('ToDo', {
	refresh(frm) {
		// your code here
// 		msgprint(frappe.session.user);
		frappe.call({
		    method:"frappe.share.call",
		    args:{doctype:"ToDo",name:doc.name,user:"XXX@gmail.com",read:1,write:1,share:0,everyone:0},
		    callback: function (r) {
				console.log(r.message);
				msgprint(r.message);
				}
		    
		});
	}
})

Please help to achieve this.