Not able post the for PO except one user

Dear All, I am facing an issue where i able to post the invoice only for one user when we try to post the invoice the invoice for the PO i am getting the following error. Please note some customization has been done. All the users having same roles and admin rights. we restart the AOS , clear chace and done incremental cil also. Debugger is also not able to catch the error. Error 1 : “Stack trace: Invalid attempt to call RunBase.promptOnClient running in CIL on the client.” Error 2 : “Microsoft.Dynamics.Ax.Xpp.InvalidRemoteCallException: Exception of type ‘Microsoft.Dynamics.Ax.Xpp.InvalidRemoteCallException’ was thrown. at Dynamics.Ax.Application.RunBase.promptOnClient(Int32 classId, Object[] packed) at Dynamics.Ax.Application.RunBase.Promptprim() in RunBase.promptPrim.xpp:line 16 at Dynamics.Ax.Application.RunBase.Prompt() in RunBase.prompt.xpp:line 12 at Dynamics.Ax.Application.RunBaseBatch.Prompt() in RunBaseBatch.prompt.xpp:line 30 at Dynamics.Ax.Application.VendInvoiceJour.Postmc() in VendInvoiceJour.PostMC.xpp:line 93 at Dynamics.Ax.Application.FormletterService.Postpurchaseorderinvoice(PurchFormLetterInvoiceContract _contract) in FormletterService.postPurchaseOrderInvoice.xpp:line 25 at FormletterService::postPurchaseOrderInvoice(Object , Object[] ) at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeInstanceCall(Object instance, String MethodName, Object[] parameters) at Dynamics.Ax.Application.SysOperationServiceController.Runoperation(Boolean _async) in SysOperationServiceController.runOperation.xpp:line 93 at Dynamics.Ax.Application.SysOperationServiceController.runServiceOperation(Object[] parameters) in SysOperationServiceController.runServiceOperation.xpp:line 22 at SysOperationServiceController::runServiceOperation(Object[] ) at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters) at Dynamics.Ax.Application.SysDictClass.invokeStaticMethod(Object[] _params) in SysDictClass.invokeStaticMethod.xpp:line 26 at SysDictClass::invokeStaticMethod(Object[] ) at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters) at Microsoft.Dynamics.Ax.Xpp.PredefinedFunctions.runAsInvoke(String className, String staticMethodName, Object[] parms, Object[]& exportInfolog)”

You have a bug in code - you’re trying to use client-bound code in CIL, which isn’t supported. Namely look at VendInvoiceJour.PostMC(), line 93.

I assume that the one user has disabled “Execute business operations in CIL” in user options.

Thanks Martin for your reply. I did not understand what it means “client-bound code in CIL” and i have checked that method mention by you VendInvoiceJour.PostMC(), line 93. there we are calling a standard dialog box over there void PostMC() { InventTrans inventTransLocal, inventTransLocal1; SkyxyInventUpdateQty InventUpdateQty, InventUpdateQtyLocal; ANA_BankMiscCharges1 ANA_BankMiscCharges,ANA_BankMiscCharges1,ANA_BankMiscCharges2; PurchLine PurchLineLoc; real adjustAmount; InventAdj_SumUp inventAdj_SumUp; inventDimParm inventDimParm; boolean adjustClosing; InventDataAdjSumUp dataAdjSumUp; container res; NumberSeq num; TmpFormLookUp tmpFormLookUp; VendTable vendTable; NumberSequenceTable numberSequenceTable; NumberSequenceRange NumberSequenceRange; Voucher Voucher; str ret, ret1; VendAccount vendAccount; LedgerJournalCheckPost jourCheckPost; LedgerJournalTable jourTable; LedgerJournalTrans jourTrans; AxLedgerJournalTable header = new AxLedgerJournalTable(); AxLedgerJournalTrans trans = new AxLedgerJournalTrans(); container offsetDim; InventParameters inventParameters; int i; inventClosing inventClosing; LedgerJournalNameId ledgerJournalNameId; DimensionAttributeValueCombination davc; LedgerJournalACType accType, offsetAccType; BankAccountTable bankAccountTable; NumberSeq numberSeq; TmpFormLookUp TmpFormLookUp1; ItemId itemid1; ; adjustClosing = true; //vendAccount = “AN411A0001”; ttsBegin; delete_from InventUpdateQty; delete_from TmpFormLookUp1; ttsCommit; select PurchLineLoc where PurchLineLoc.PurchId == this.PurchId;//“Test34” itemid1 = PurchLineLoc.ItemId; { while select sum(adjustNow) from ANA_BankMiscCharges group by ItemId where ANA_BankMiscCharges.itemId == itemid1 && ANA_BankMiscCharges.PurchId == “” { while select inventTransLocal1 where inventTransLocal1.ItemId == ANA_BankMiscCharges.ItemId && inventTransLocal1.InvoiceId == this.InvoiceId { if(inventTransLocal1) { InventUpdateQty.ItemId = inventTransLocal1.ItemId; InventUpdateQty.Qty = inventTransLocal1.Qty; InventUpdateQty.CostValue = inventTransLocal1.CostAmountPhysical +inventTransLocal1.CostAmountAdjustment;//.postedValue;//.costValue(); InventUpdateQty.InventTransOrigin = inventTransLocal1.InventTransOrigin;///5641875332;//inventTransLocal1.InventTransOrigin; InventUpdateQty.RefRecId = inventTransLocal1.RecId;//5643193663;//inventTransLocal1.RecId; InventUpdateQty.insert(); adjustAmount += ANA_BankMiscCharges.adjustNow; //res += [ANA_BankMiscCharges]; TmpFormLookUp1.itemId = inventTransLocal1.itemId; TmpFormLookUp1.LineNo = TmpFormLookUp1.LineNo +1; TmpFormLookUp1.adjustNow = ANA_BankMiscCharges.adjustNow; TmpFormLookUp1.postedValue = InventUpdateQty.CostValue;//costANA_BankMiscCharges.postedValue; TmpFormLookUp1.ReferenceCategory = InventTransType::Sales; //TmpFormLookUp1.transRecId = ANA_BankMiscCharges.transRecId; TmpFormLookUp1.InventDimId = inventTransLocal1.InventDimId; //TmpFormLookUp1.ReferenceId = ANA_BankMiscCharges.ReferenceId; select ANA_BankMiscCharges2 where ANA_BankMiscCharges2.itemId == inventTransLocal1.itemId; TmpFormLookUp1.qty = ANA_BankMiscCharges2.qty; TmpFormLookUp1.insert(); //res += [ANA_BankMiscCharges]; dataAdjSumUp = InventDataAdjSumUp::newFromForm(tmpFormLookup); inventAdj_SumUp = InventAdj_SumUp::newSumUp(dataAdjSumUp.pack(), inventDimParm, today(), adjustClosing); “”"/if (!inventAdj_SumUp.prompt())//Line no 93 { return; }/"""" inventAdj_SumUp.run(); } } // else // { // info(“invoice not found”); // return; // } /* dataAdjSumUp = InventDataAdjSumUp::newFromForm(tmpFormLookup); inventAdj_SumUp = InventAdj_SumUp::newSumUp(dataAdjSumUp.pack(), inventDimParm, today(), adjustClosing); if (!inventAdj_SumUp.prompt()) { return; } inventAdj_SumUp.run();*/ } ttsBegin; while select forupdate ANA_BankMiscCharges1 where ANA_BankMiscCharges1.itemId == PurchLineLoc.ItemId { ANA_BankMiscCharges1.PurchId = this.PurchId; ANA_BankMiscCharges1.doUpdate(); } ttsCommit; } } secondly that options for the user is enabled for all the users including one where everything is working fine.

Yes, I know - the dialog is the bug.

If you execute your code in batch or in a CIL session, you can use only server code. Anything that requires the client, such as a form, will fail. You must remove all such code from the SysOperation service. The SysOperation framework already supports dialogs and it runs them before starting the operation. That’s what you should use.

By the way your posts are barely readable - try formatting with “pre” HTML tag.

Hi Martin,

I have the exact same error which was mentioned in this thread. After reading your reply I have a question which hopefully will make things clear for me. What exactly do you meant by “if you execute your codine in a CIL session”? What is the case when client-bound code can’t be used? How can I identify such case? I doubt you just meant the value of “Execute business operations in CIL” checkbox, because even when this checkbox is checked client-bound code works perfectly.

I’ve already found out that some developer has added a customization code in SalesFormletterParmDataInvoice.createData() which caused executing Maps\priceDiscHeading\updateMultiLineDisc method. This method includes a call to runPriceDiscPolicyDialog() which, I think, contains client-bound code. So the only thing left is to assure that code was executed in a CIL session (it wasn’t execute in batch) to confirm that client-bound code can’t be used here. Here’s the error text:

Microsoft.Dynamics.Ax.Xpp.InvalidRemoteCallException: Exception of type ‘Microsoft.Dynamics.Ax.Xpp.InvalidRemoteCallException’ was thrown.
at

Dynamics.Ax.Application.RunBase.promptOnClient(Int32 classId, Object[] packed)
at Dynamics.Ax.Application.RunBase.Promptprim() in RunBase.promptPrim.xpp:line 16
at

Dynamics.Ax.Application.RunBase.Prompt() in RunBase.prompt.xpp:line 12
at Dynamics.Ax.Application.PriceDiscPolicyDialog.Runpolicydialog() in

PriceDiscPolicyDialog.runPolicyDialog.xpp:line 20
at Dynamics.Ax.Application.PriceDiscResultFields.Runpricediscpolicydialog(Int32 _fieldId, Boolean _showLineItem, Boolean

_skipTriggerFieldCheck, Boolean , Boolean , Boolean ) in PriceDiscResultFields.runPriceDiscPolicyDialog.xpp:line 54
at

Dynamics.Ax.Application.PriceDiscResultFields.@Runpricediscpolicydialog(Int32 _fieldId, Boolean _showLineItem, Boolean , Boolean )
at

Dynamics.Ax.Application.PriceDiscResultFields.@Runpricediscpolicydialog(Int32 _fieldId, Boolean )
at Dynamics.Ax.Application.PriceDiscResultFields.Runpricediscpolicydialog(Int32 _fieldId)

at Dynamics.Ax.Application.PriceDiscHeading.Updatemultilinedisc(PriceDiscLine _priceDiscLine, Boolean _bypassDialog, Boolean ) in

PriceDiscHeading.updateMultiLineDisc.xpp:line 40
at Dynamics.Ax.Application.PriceDiscHeading.Updatemultilinedisc(PriceDiscLine _priceDiscLine)
at

Dynamics.Ax.Application.SalesTable.Upatemultilinedisc() in SalesTable.updateMultiLineDisc.xpp:line 6
at

Dynamics.Ax.Application.SalesFormletterParmDataInvoice.Tigcalcecotax() in SalesFormletterParmDataInvoice.tigCalcEcotax.xpp:line 21
at

Dynamics.Ax.Application.SalesFormletterParmD
ataInvoice.Createdata(Boolean _append, Boolean ) in SalesFormletterParmDataInvoice.createData.xpp:line 17
at

Dynamics.Ax.Application.SalesFormletterParmD
ataInvoice.Createdata(Boolean _append)
at Dynamics.Ax.Application.SalesFormletterParmData.executeChooseLinesServer

(Object[] _salesFormletterContractPacked, Boolean _append, Boolean _reuseParmUpd
ate, Boolean _onlyCreateParmUpdate, Boolean _executeLateSelection, Boolean , Boolean , Boolean )
in SalesFormletterParmData.executeChooseLinesServer.xpp:line 22
at Dynamics.Ax.Application.SalesFormletterParmD
ata.executeChooseLinesServer(Object[]

_salesFormletterContractPacked, Boolean _append, Boolean _reuseParmUpdate, Boolean _onlyCreateParmUpdate, Boolean _executeLateSelection)
at

Dynamics.Ax.Application.SalesFormletterParmData.chooseLinesServerIL(Object[] _inputContract) in SalesFormletterParmData.chooseLinesServerIL.xpp:line 6
at

SalesFormletterParmData::chooseLinesServerIL(Object[] )
at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)

at Dynamics.Ax.Application.SysDictClass.invokeStaticMethod(Object[] _params) in SysDictClass.invokeStaticMethod.xpp:line 26
at

SysDictClass::invokeStaticMethod(Object[] )
at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)
at

Microsoft.Dynamics.Ax.Xpp.PredefinedFunctions.runAsInvoke(String className, String staticMethodName, Object[] parms, Object[]& exportInfolog)

X++ code can run on client and AOS, which are two different processes and often run on completely different machines. Usually you can use mix code running on client and server and it will work, although it can cause huge performance problems. But sometimes code is executed without client, therefore if you want to execute code on client, it will fail. CIL is a similar case - it doesn’t exist on client at all.

Client-bound code is code configured to always run on client. It included classes with RunOn=Client, static methods with “client” keyword, all forms etc. You’ll find details in documentation. Just note that it has nothing to do with CIL; three-tier architecture worked the same in previous versions of AX as well (that didn’t support compilation to CIL).