Showing posts with label Ax 2012 AIF. Show all posts
Showing posts with label Ax 2012 AIF. Show all posts

Thursday, September 18, 2014

The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state in Dynamics Ax 2012 R3

Service error related to communication in dynamics ax 2012: Have a look on the followings:
- Full compilation
- Full CIL
- Refresh AIF services from AOT form "AIFService"
- Register services from AOT under "Services" node
- Check your AOS host file under "Windows/System32/Driver/Etc/Host.Config for any wrong entry for the AOS machine name
------------------------------------Error Message--------------------------------------------------------
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> 

System.ServiceModel.CommunicationObjectFaultedException: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication 

because it is in the Faulted state.Server stack trace:    at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)   at 

System.ServiceModel.Channels.ServiceChannel.System.IDisposable.Dispose()Exception rethrown at [0]:    at 

System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke

(MessageData& msgData, Int32 type)   at System.IDisposable.Dispose()   at Microsoft.Dynamics.AX.Framework.Workflow.Model.WorkflowModelCache.SetDataTypeCache()   

at Microsoft.Dynamics.AX.Framework.Workflow.Model.WorkflowModelCache.Create(IAxClient client, String templateName, String domainUser, String companyId, Boolean 

runtimeCache)   at Microsoft.Dynamics.AX.Framework.Workflow.Model.WorkflowModel.Create(String templateName, String companyId, String owner, String domainUser)   

--- End of inner exception stack trace ---   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)   

at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)   at System.Reflection.RuntimeMethodInfo.Invoke

(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)   at 

Microsoft.Dynamics.AX.ManagedInterop.ClrBridgeImpl.InvokeClrStaticMethod(ClrBridgeImpl* , Char* pszClassName, Char* pszMethodName, Char* assemblyName, Int32 

argsLength, ObjectWrapper** arguments, Boolean* argsAreByRef, Boolean* isException)
  

Tuesday, May 13, 2014

The value in field 'Record-ID' is not found in the related table 'Electronic payment - remittance'

I had an issue during update AIF service operation on project expense journal inbound interface. It says

The value '5637150577' in field 'Record-ID' is not found in the related table 'Electronic payment - remittance'

The error prompts when  LedgerJournalTrans fields are validated during AIF service. But, the unusual things is, when LedgerJournalTrans.RecID goes through the function validateField() in LedgerJournalTrans table, it calls the super() in following default switch statement code snippet and results such error:
              default:
                //
                if ((TaxParameters::checkTaxParameters_IN() || TaxWithholdParameters_IN::checkTaxParameters()) &&
                    (this.Company != this.OffsetCompany))
                {
                    // When Two different companies are involve in invoice and payment..
                    ret = true;
                }
                else
                {
                //

                    ret = super(field);
                //
                }
                //

As an workaround, I had to get this "RecID" field in the switch case statement as follows so that it results true and continues:

// Dip, HP ES
            case fieldNum(LedgerJournalTrans, RecId):  
                ret = true;
                break;
            //
            default:
                //
                if ((TaxParameters::checkTaxParameters_IN() || TaxWithholdParameters_IN::checkTaxParameters()) &&
                    (this.Company != this.OffsetCompany))
                {
                    // When Two different companies are involve in invoice and payment..
                    ret = true;
                }
                else
                {
                //

                    ret = super(field);
                //
                }
                //

Cheers !

Thursday, June 6, 2013

The account type must be one of the following types: Ledger, Bank, Vendor.

In AIF, an inbound document for customer general journal invoice creation, an exception is thrown for as follows:

The account type must be one of the following types: Ledger, Bank, Vendor.

This is because, Ax restricts to create customer invoice for journal type of "Daily" in general journal invoicing and suggests to create a free text invoice. But the code can be modified to accommodate the same.


Friday, March 9, 2012

Object does not have method error in AIF - Dynamics Ax 2012

There is sometime an error prompts during processing outbound files which says - Error executing code: AxXXX class object does not have parmXXX(). This parmXXX() method may be a new calculated/unbounded method or a bounded method in AxXXXX class objects which extends AxInternalBase.






























There are few things need to be performed to take this error out. It is basically a compilation problem where the method object can not be found at runtime.
First, use compile and  compile forward for all the objects pertaining to a AIF document service.
Secondly, compile forward the base class - AxInternalBase
At last, select the project node and "Generate incremental CIL".

































The outbound messages can be processed now with not this type of error.

Tuesday, March 6, 2012

Adding calculated field in Dynamics Ax 2012 AIF Data policy

Sometime, it required to add few fields which are unbounded, i.e. not directly available in a table or query pertaining to AIF service class. These calculated fields are made available using a parm() method. 

For example, in the existing CustCustomerService, we need to send the trading partner company id. In this case, we will create a parm method named as parmIntercompanyComapnyId().

Write down these method in the AIF artifacts of type AxBc class for the underlying table.



Refresh the AIFService form from AOT. This will list down the new fields in the document data policy form.


 

Monday, March 5, 2012

Adding fields to existing AIF service

After adding a few new fields to existing query/table, pertaining to AIF document service, will not be automatically appears in the document data policies for a service. In order to reflect those new fields in the data policies, you need to open a form from AOT named as AIFService and click the refresh button on this.