Skip to main content

Notifications

Announcements

No record found.

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

  • Tina Vyf Profile Picture
    Tina Vyf on at
    RE: Error: "Stack trace: Invalid attempt to call Box.yesNo running in CIL on the client." when posting invoice.

    Thanks! I will try that too.

  • nunomaia Profile Picture
    nunomaia 9 Super User 2024 Season 1 on at
    RE: Error: "Stack trace: Invalid attempt to call Box.yesNo running in CIL on the client." when posting invoice.

    You can check if is executing in CIL by

    If (!xSession::isCLRSession())

    {

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

    }

  • Verified answer
    Tina Vyf Profile Picture
    Tina Vyf on at
    RE: Error: "Stack trace: Invalid attempt to call Box.yesNo running in CIL on the client." when posting invoice.

    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 

  • Tina Vyf Profile Picture
    Tina Vyf on at
    RE: Error: "Stack trace: Invalid attempt to call Box.yesNo running in CIL on the client." when posting invoice.

    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. :-)

  • Suggested answer
    5400 Profile Picture
    5400 7,162 on at
    RE: Error: "Stack trace: Invalid attempt to call Box.yesNo running in CIL on the client." when posting invoice.

    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.

  • Verified answer
    nunomaia Profile Picture
    nunomaia 9 Super User 2024 Season 1 on at
    RE: Error: "Stack trace: Invalid attempt to call Box.yesNo running in CIL on the client." when posting invoice.

    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 ?  

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,661 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,379 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans