Netsuite 用于收集新创建记录的id并将其设置到另一个记录上的客户端脚本

Netsuite 用于收集新创建记录的id并将其设置到另一个记录上的客户端脚本,netsuite,suitescript,suitescript2.0,Netsuite,Suitescript,Suitescript2.0,我希望捕获新创建项目的内部id,并将其设置为案例记录上的值。目前我正在使用客户端脚本执行其他操作,因此我希望在同一脚本文件中完成此任务。我已尝试使用saveRecord入口点。我知道在将数据提交到数据库之前执行。我还了解,内部id是在提交数据后/提交数据时创建的。有人知道在客户端脚本中完成此操作的变通方法吗 客户端脚本示例: var oldCaseId; //global variable that is set by the pagInit function when the project

我希望捕获新创建项目的内部id,并将其设置为案例记录上的值。目前我正在使用客户端脚本执行其他操作,因此我希望在同一脚本文件中完成此任务。我已尝试使用saveRecord入口点。我知道在将数据提交到数据库之前执行。我还了解,内部id是在提交数据后/提交数据时创建的。有人知道在客户端脚本中完成此操作的变通方法吗

客户端脚本示例:

var oldCaseId; //global variable that is set by the pagInit function when the project first loads

function saveRecord(context) {
  var curRec = context.currentRecord;
  var caseId = curRec.getValue({fieldId: 'custentity_project_case_id'});
  if (oldCaseId != caseId){
    record.submitFields({
      type: record.Type.SUPPORT_CASE,
      id: caseId,
      values: {
        custevent_ee_case_associated_project: curRec.id
      },
      options: {
        //enableSourcing: false,  ///default is true
        ignoreMandatoryFields : true //default is false
      }
    });
  }
  return true;
}
用户事件脚本示例代码。这是可行的,但这是因为“afterSubmit”是在数据提交到数据库(即内部id存在)之后执行的

function afterSubmit(context){
  var projectRec = context.newRecord;
  var caseId = projectRec.getValue({fieldId: 'custentity_ee_project_case'});
  record.submitFields({
    type: record.Type.SUPPORT_CASE,
    id: caseId,
    values: {
      custevent_ee_case_associated_project: projectRec.id
    },
    options: {
      //enableSourcing: false,  ///default is true
      ignoreMandatoryFields : true //default is false
    }
  });
}