最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

AX 2012: Trigger AIF Document Service Outbound Message in X++

网络文摘 William 1951浏览 0评论

Purpose:

The purpose of this document is to illustrate how we can trigger the generation of AIF document service outbound message in X++.

Business requirement:

Ability to generate an AIF outbound xml message on demand.

Assumptions:

Outbound port is configured using file system adapter.

Development:

Please find the job below to trigger an AIF document service outbound message in X++. The job uses the standard CustCustomerService class to generate outbound xml for customer data. Likewise the code can be used for any other valid document service class.

// Developed on 18 Feb 2016 by Muhammad Anas Khan
// Blog: dynamicsaxinsight.wordpress.com
// LinkedIn: pk.linkedin.com/in/muhammadanaskhan
// Description: Trigger AIF document service outbound message
static void sendElectronically(
    XMLDocPurpose _xMLDocPurpose,
    AifSendMode   _aifSendMode = AifSendMode::Async)
{
    AxdSendContext    axdSendContext = AxdSendContext::construct();
    AifEntityKey      aifEntityKey = AifEntityKey::construct();
    AifConstraintList aifConstraintList = new AifConstraintList();
    AifConstraint     aifConstraint = new AifConstraint();
    CustTable         custTable;
    Map               keyData;
    
    custTable = CustTable::find("1101");
    
    keyData = SysDictTable::getKeyData(custTable);
    aifEntityKey.parmTableId(custTable.TableId);
    aifEntityKey.parmRecId(custTable.RecId);
    aifEntityKey.parmKeyDataMap(keyData);
    axdSendContext.parmXMLDocPurpose(_xMLDocPurpose);
    axdSendContext.parmSecurity(false);
    aifConstraint.parmType(AifConstraintType::NoConstraint);
    
    aifConstraintList.addConstraint(aifConstraint);
    AifSendService::submitDefault(
        classnum(CustCustomerService),  //Service class goes here
        aifEntityKey,
        aifConstraintList,
        _aifSendMode,
        axdSendContext.pack());
}

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址