web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Error: "Stack trace: Invalid attempt to call Box.yesNo running in CIL on the client." when posting invoice.

(0) ShareShare
ReportReport
Posted on by

When I post an invoice, and CIL is activated, I get the following error:

Stack trace: Invalid attempt to call Box.yesNo running in CIL on the client.

 If I deactivate CIL, I see the following YesNo box:

yes-no.jpg

I then click on yes and the invoice is posted like I expected. (This only dialog only appears when there are VendTrans and VendTransOpen records that are settled during posting of the final invoice, in other words if payments were made related to this order.)

This dialog originates from the VendOpenTransForm class in the showMessage() dialog. This class has the setting Called from in its RunOn property. I change the RunOn property to Client, in the hope that it will force the CIL to run the code on the client and show the dialog. Unfortunately it still shows the stack trace instead of the dialog.

Has anyone else experienced this issue? What can I do to make sure the Yes No dialog is displayed, even when the code is running in CIL?

Stack trace: Invalid attempt to call Box.yesNo running in CIL on the client.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    nunomaia Profile Picture
    25 Moderator on at

    There a code execution in CIL that that is trying to executed in AX client, client can’t handle that. There is any customization to display that message ?  

  • Suggested answer
    5400 Profile Picture
    7,162 on at

    only server side code and server side API can execute on CIL. You can not execute client code or client API in CIL. Is it your custom code, if not should put one validation Xsession::isonCIL() skip the dialog. if you run on batch with multiple invoice, it is not good practice to display dialog box.

  • Tina Vyf Profile Picture
    on at

    Can you give me an example of Xsession::isonCIL() or a link to documentation? If I google Xsession::isonCIL(), the only result I get is your answer on this page. :-)

  • Verified answer
    Tina Vyf Profile Picture
    on at

    Hi Nuno, thank you for your answer. We have no customization in the VendOpenTransForm class and the showMessage() method is declared protected, so I assumed the problem was not with a customization of ours.

    You reply did get me to think about how our customizations could cause this issue. It turns out that the VendOpenTransForm class is called by one of our custom classes, and that class runs on the server. Since the VendOpenTransForm RunOn property is set to Called from, that method is also run on the server.

     

    I added a condition so that the dialog is only displayed when the class is running on the client. This way all standard Microsoft code should run as usual, but when we call the class on the server, yes is chosen automatically and the dialog is not displayed to the user.

     

    Thanks again for your answer. It definitely pointed me in the right direction!

    VendOpenTransForm 

  • nunomaia Profile Picture
    25 Moderator on at

    You can check if is executing in CIL by

    If (!xSession::isCLRSession())

    {

    // Some code here which you don’t want to execute

    }

  • Tina Vyf Profile Picture
    on at

    Thanks! I will try that too.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 3

#3
Scott_itD Profile Picture

Scott_itD 2 Community Manager

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans