简体   繁体   English

Dynamics AX 2012 R3-通过AIF Web服务创建记录

[英]Dynamics AX 2012 R3 - Record Creation through AIF web service

I am having issues using an AIF web service to create a unique primary key in our contract module in Dynamics AX. 我在使用AIF Web服务在Dynamics AX的合同模块中创建唯一主键时遇到问题。 Our contract PK's are in a format of 'CON-######', and the contractId is tied to a number sequence in AX. 我们的合同PK格式为“ CON-######”,并且contractId绑定到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. 当我调用“创建”服务操作时,我为“ ContractId”传递了0,而AX并未将其0替换为数字序列中的实际合同ID。

The AX service endpoint is configured as an enhanced port. AX服务端点被配置为增强端口。 Is there a setting that needs to be enabled on the AX service endpoint? 是否需要在AX服务端点上启用设置? Is there a method override on the AX side that needs to be implemented? 在AX端是否有需要实现的方法替代?

I have a class CallContext variable named CC, and a CreateEntityKey[] method that should insert a new entity. 我有一个名为CC的CallContext类变量,以及一个应该插入新实体的CreateEntityKey []方法。

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;
}

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). 据我所知,AIF通常不支持开箱即用的数字序列字段,而仅支持某些实体(例如销售订单)。 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. 看一下类AxSalesTable和方法setSalesId实现方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM