Update field in other doctype when current doctype is saved

Hi guys. Need a little help.
I got 2 DocTypes:

  1. Item (field name: has_been_assigned)
  2. Custom doctype named Stations(field name: item_assigned)

So when in Stations, i select a item belonging to that station which is a link to items. When i save this form now. How do i update the has_been_assigned value in items? This value is a check type so i know it has to eqaul 1 , but how do you accomplish this?

I tried this in custom script:
frappe.ui.form.on(“Station”, “validate”, function (frm, cdt, cdn) {
if(frm.doc.item_assigned!=“”){
obj = frappe.get_doc(“Item”,frm.doc.item_assigned.item_code);
obj.has_been_assigned= 1;
obj.save()
obj.submit()
}
});