Deprecated features in AX 7

AX7-1-1170x630

https://ax.help.dynamics.com/en/wiki/deprecated-features-in-dynamics-ax-7/

Complete list is available on above link for the deprecated features in AX7 but the important one to me as Technical on AX is AIF service. here is statement from Microsoft about it. I will share separate blogs about the replacements and defiantly in AX7 we have better options for implementing the integrations.

In Application Integration Framework (AIF), data can be exchanged with external systems through business logic that is exposed as services. Microsoft Dynamics AX includes services that are based on documents and .NET Business Connector (AxBC). A document is created by using XML. The XML includes header information that is added to create a message that can be transferred into or out of Microsoft Dynamics AX. Examples of documents include sales orders and purchase orders. However, almost any entity, such as a customer, can be represented by a document. Services that are based on documents use the Axd <Document> classes.

Reason for deprecation The architecture of AIF and AxDs could not be scaled to a cloud service. There were performance issues around bulk import.
Replaced by another feature? In the current version of Dynamics AX, this feature is replaced by Data Import/Export framework, which supports recurring bulk import/export. For AxBC, we recommend that you use the actual tables.
Modules affected AxDs, AxBCs, and AIF

Update order header through AIF

The following code sample shows how to update an existing order through AIF from outside Dynamics AX 2012 . Scenario is the we need to update some of the fields at header of Order.

 public static int UpdatePurchaseOrder(string _purchId, CallContext CallContextObj = null)  
     {  
       try  
       {  
         KeyField keyField = new KeyField() { Field = "PurchId", Value = _purchId };  
         EntityKey entityKey = new EntityKey();  
         entityKey.KeyData = new KeyField[1] { keyField };  
         EntityKey[] entityKeys = new EntityKey[1] { entityKey };  
         if (CallContextObj == null)  
         {  
           CallContextObj = CallContextSettings.getCallContextObject();  
         }  
         using (ANPurchOrderServiceClient client = new ANPurchOrderServiceClient())  
         {  
           client.ClientCredentials.Windows.ClientCredential.Domain = CredentialsSettings.Domain;  
           client.ClientCredentials.Windows.ClientCredential.UserName = CredentialsSettings.UserName;  
           client.ClientCredentials.Windows.ClientCredential.Password = CredentialsSettings.Password;  
           AxdANPurchOrder PurchaseOrderDoc = client.read(null, entityKeys);  
           AxdEntity_PurchTable purchTable = PurchaseOrderDoc.PurchTable.First();  
           purchTable.ANPublishedState = AxdEnum_ANPublishedState.Published;  
           purchTable.ANPublishedStateSpecified = true;  
           purchTable.action = AxdEnum_AxdEntityAction.update;  
           purchTable.actionSpecified = true;  
           purchTable.PurchLine = null;  
           // Invoke the update operation  
           AxdANPurchOrder newOrder = new AxdANPurchOrder()  
           {  
             PurchTable = new[] { purchTable }  
           };  
           client.update(CallContextObj, entityKeys, newOrder);  
           return 1;  
         }  
       }  
       catch (Exception ex)  
       {  
         Console.WriteLine(ex.ToString());  
       }   
       return 0;  
     }  

With above code we did as per need, read the purchase order document through read operation, set some fields and last set actions also. when I try to test the application I got some funny strange error

“Invalid entity action.”

This error confuse me also, as I have set the action also. After some research I came to know that read operation of service is returning both header and lines also, which I don’t need that for my scenario. So the fix is that I need to set the line object to null also and then send for update operation.

purchTable.PurchLine = null;

Question after this fix came In my mind is that can we only read header or specific line through read operation ? I will research about this more. If anyone knows this please share your thoughts with me. THANKS