≡ Menu

Invalid attempt to call DocuActionArchive.Add running in CIL on the client. Dynamics Ax 2012


A few day ago I shared a code about to document attachment.


This code  works fine at client side, but in runbatchjob (batch process) run at server side It threw following error.


“Invalid attempt to call DocuActionArchive.Add running in CIL on the client.”

This is because in Add method winapi is used. This winapi written for running at client side.

I solve this problem by following steps.

  1. Duplicate the DocuActionArchive and rename the new classes as clsDocuActionArchieve
  2. Change the class run at client to run at server.
  3. Inside add method replace winapi to WinAPIServer. There are three places where you have to replace winapi to wimapiserver.
  • Comment the wimapi::getOpenFileName it did not exists in winserverapi.
  • Wimapi::fileSize to winserverapi::fileSize
  • Wimapi::copyFile to winserverapi::copyfile.


Compile the code and use the new class instead of DocuActionArchive. The code will work at server side.




{ 0 comments… add one }

Leave a Comment