Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 17314

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

$
0
0

 

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

http://tech.alirazazaidi.com/document-attachment-through-x-code-dynamics-ax-2012-r3/

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.

 

 

 


Viewing all articles
Browse latest Browse all 17314

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>