axapta - Error: The cursor is invalid for instantiating recordViewCache -


i trying re-use class , run in job prove out. here job code:

inventquarantineorder_scrap scrap = new inventquarantineorder_scrap(); ;  scrap.parminventquarantineid('00016749_077'); scrap.parmscrapqty(360); scrap.parmtransdate(today());  scrap.run(); 

when run code, error:

the cursor invalid instantiating recordviewcache

researching error led me link, tried implement got syntax errors i'm not sure how fix. copied class , created new runonserver method. validate method doesn't work. modify validate method run on server:

static server boolean  validate() {      inventquarantineorder inventquarantineorder =  inventquarantineorder::find(inventquarantineid);      ;        ....     } 

which gave me error:

variable inventquarantineid has not been declared.

if comment out validate() call runonserver method, same error/problem inventquarentineid variable not being declared (it's used in run method).

from here, not sure how continue. doing wrong? possible use these methods inside server method? thing worth noting think think job code worked, did throw 3 lines "cursor invalid instantiating recordviewcache." info alerts.

as found out, recordviewcache can used on server tier. starting process in job on client tier, method creates recordviewcache (method viewcacheinventtransid of table inventtrans) executed on client tier, causes error. if put breakpoint in method, call stack in debugger shows this:

tier   method                                                                                                line [c]    \data dictionary\tables\inventtrans\methods\viewcacheinventtransid                                      9 [c]    \classes\inventmovement\viewcacheinventtransid                                                          7 [s]    \classes\inventupd_financial\initupdate                                                                14 [s]    \classes\inventupd_financial\newvirtuelquarantineloss                                                  19 [c]    \classes\inventquarantineorder_scrap\run                                                               76 [c]    \jobs\job4   

the solution in link gave case bit more complicated needs (my comment first idea fix solution). need create class static server method executes job code. can call static server method in code. debugger show following call stack:

tier   method                                                                                                line [s]    \data dictionary\tables\inventtrans\methods\viewcacheinventtransid                                      9 [s]    \classes\inventmovement\viewcacheinventtransid                                                          7 [s]    \classes\inventupd_financial\initupdate                                                                14 [s]    \classes\inventupd_financial\newinventquarantineorder                                                  21 [s]    \data dictionary\tables\inventquarantineorder\methods\startfinancial                                   12 [s]    \classes\inventquarantineorder_scrap\run                                                               54 [s]    \classes\class1\jobonserver                                                                            10 [c]    \jobs\job4                                                                                              5 

Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -