1. 程式人生 > >onSubmit 檢查是否有衝突修改,彈出對話方塊讓user確定或者取消

onSubmit 檢查是否有衝突修改,彈出對話方塊讓user確定或者取消

// Warn when two users are editing the same record

function onSubmit() {

   var updatedOn = gel('onLoad_sys_updated_on').value;

   if (!updatedOn)

      return;

   var gr = new GlideRecord(g_form.getTableName());

   if (!gr.get(g_form.getUniqueValue()))

      return;

   var dbUpdatedOn = gr.sys_updated_on + '';

   var dbUpdatedBy = gr.sys_updated_by + '';

   if (updatedOn != dbUpdatedOn)

      return confirm(dbUpdatedBy + " " + getMessage("updated this record since you opened it - overwrite with your changes? Additional comments and Work notes will not be overwritten."));

}