Workflow - Dialog on transition

Hi all,
I created workflow for Material Request.

  • Draft (Purchase User) → Send for Approval(Purchase User) →
    Approve(Purchase Manager) → Reject(Purchase Manager)

In that if Purchase manager reject the material request, I need dialog over there for capture reason of rejection. Captured reason will be set to custom field.

@Sangram use

frappe.ui.form.on("Material Request", "workflow_state", function(frm, cdt, cdn){
  if (frm.doc.worflow_state ==== "Reject"){
    // do something
  }
});

Thanks, max_morais_dmm .
Issue is solved
Previously my workflow was :
Draft (Purchase User) → Send for Approval(Purchase User) →
Approve(Purchase Manager) → Reject(Purchase Manager) ->Draft
So, reject state not captured. That directly goes to Draft

Thank you…