Change status task from another doctype

I’m trying to when i submit a form in another custom doctype it will automatically change the status task that link with document in custom doctype. is there anyway i can do this?

Reference: