Dynamics AX 2012 R3 - Record Creation through AIF web service

百般思念 提交于 2019-12-25 08:57:28

问题


I am having issues using an AIF web service to create a unique primary key in our contract module in Dynamics AX. Our contract PK's are in a format of 'CON-######', and the contractId is tied to a number sequence in AX. When I call the 'Create' service operation, I am passing a 0 for 'ContractId' and AX is not replacing that 0 with an actual contract Id from the number sequence.

The AX service endpoint is configured as an enhanced port. Is there a setting that needs to be enabled on the AX service endpoint? Is there a method override on the AX side that needs to be implemented?

I have a class CallContext variable named CC, and a CreateEntityKey[] method that should insert a new entity.

private CallContext cc = new CallContext() { Company = "MYCOMPANY", Language = "en-us" };

public EntityKey[] CreateEntityKey(AxdEntity_CLMContractTable axdBtmContractTable) 
{

     EntityKey[] ek = null;

     AxdBtmContractHdr axBtmContractHeader = new AxdBtmContractHdr() 
     { 
          CLMContractTable = new AxdEntity_CLMContractTable[] 
          { 
               axdBtmContractTable 
          } 
      };

      try
      {
          ek = _client.create(cc, axBtmContractHeader);
      }
      catch (Exception e)
      {
          ek = null;
      }

      return ek;
}

回答1:


As far as I know, AIF does not generally support number sequence fields out of the box, but only for some entities (sales orders for example). This means you have to implement your own logic to create a new number from a number sequence. Take a look at class AxSalesTable, method setSalesId on how this is done.



来源:https://stackoverflow.com/questions/38661658/dynamics-ax-2012-r3-record-creation-through-aif-web-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!