Ax开发:关于错误 The cursor is invalid for instantiating recordViewCache
如果在调用系统类的时候,常见为使用 InventUpd_***** 类,
The cursor is invalid for instantiating recordViewCache
跟踪代码的时候你会发现错误发现在:
Tables\InventTrans\Methods:
static RecordViewCache viewCacheInventTransId(InventTransId _inventTransId, boolean _forupdate = false)
{
InventTrans inventTrans;
;
inventTrans.selectForUpdate(_forupdate);
select nofetch inventTrans index hint TransIdIdx where inventTrans.InventTransId == _inventTransId;
return new RecordViewCache(inventTrans);
}
如果你也用JOB测试过这几行代码你会发现总是在这一句出错,原因是RecordViewCache只能存在于服务器端,而JOB是运行在客户端上的,
同理,你在类中调用使用到此方法的类时,通常的原因都是因为你执行调用的方法没有标记为运行在服务器端,即加 "server"关键字,这个错误就不复存在了。