如何通过代码获取作业进程中的BatchJob Recid?

How to get by code the BatchJob Recid in job process?

我有一个习惯 class extends RunbaseBatch。在 run 方法中,我想获得 BatchJob RecId。我尝试使用这些代码行:

this.batchInfo().parmBatch();
// or 
this.batchInfo().parmBatch().BatchJobId;

但在这两种情况下,方法都检索到空值。有什么办法可以得到这些信息吗?我在哪里可以获取这些数据?

看看静态方法BatchHeader::getCurrentBatchHeader (MSDN)

它 returns class BatchHeader 的对象 属性 parmBatchHeaderId 应该包含您想要的信息。