Error when automatically filling up field based on lookup field

Error when automatically filling up field based on lookup field

I tried running this code:

  1. try{
  2. var procurementId = ZDK.Page.getField("Procurement_List").getValue().id;
  3. log(procurementId);
  4. ZDK.Page.getField("Procurement_list_email").setValue(ZDK.Apps.CRM.Procurements.fetchById(procurementId).email);
  5. }
  6. catch (error) {
  7.     ZDK.Client.showAlert("Something went wrong. Kindly contact Administrator. " + error);
  8. }
however the issue is that it keeps on giving me an error.