Change status of a document while saving another document

Hi guys,

I have edited the job applicant status to “selected interview” & “Rejected Interview”.I want to automatically change the status of the job applicant to “selected interview” while saving the interview doc in “cleared” status. Please help me with this

So for my issue, I actually figured out the solution.

after_save(frm){
//console.log(“sssssssssss”)

if(frm.doc.status==="Cleared")
{
    var a = frm.doc.job_applicant
    //console.log(a,"mmmmmmmmmmmmm")
    msgprint("Job applicant Status changed")
    frappe.db.set_value("Job Applicant",frm.doc.job_applicant,"status","Selected - Interview")
}
   

if(frm.doc.status==="Rejected")
{
    var b = frm.doc.job_applicant
    //console.log(a,"mmmmmmmmmmmmm")
    msgprint("Job applicant Status changed")
    frappe.db.set_value("Job Applicant",frm.doc.job_applicant,"status","Rejected - Interview")
   
}

},