Dynamics AX 2012 R3 - Record Creation through AIF

2019-09-14 03: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条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-09-14 03:58

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.

查看更多
登录 后发表回答