Monday, August 28, 2017

AIF Document Service Outbound Message trigger in X++

//AIF Document Service Outbound Message trigger in X++
//Trigger outbound message through AIF document service
static void sendOutMsg(XMLDocPurpose _xMLDocPurpose,AifSendMode   _aifSendMode = AifSendMode::Async)
{
    AxdSendContext    axdSendContext = AxdSendContext::construct();
    AifEntityKey      aifEntityKey = AifEntityKey::construct();
    AifConstraintList aifConstraintList = new AifConstraintList();
    AifConstraint     aifConstraint = new AifConstraint();
    VendTable         vendTable;
    Map               keyData;
   
    vendTable = VendTable::find("V05000");
   
    keyData = SysDictTable::getKeyData(vendTable);
    aifEntityKey.parmTableId(vendTable.TableId);
    aifEntityKey.parmRecId(vendTable.RecId);
    aifEntityKey.parmKeyDataMap(keyData);
    axdSendContext.parmXMLDocPurpose(_xMLDocPurpose);
    axdSendContext.parmSecurity(false);
    aifConstraint.parmType(AifConstraintType::NoConstraint);
   
    aifConstraintList.addConstraint(aifConstraint);
    AifSendService::submitDefault(
        classnum(VendVendTableService),
        aifEntityKey,
        aifConstraintList,
        _aifSendMode,
        axdSendContext.pack());
}

No comments:

Post a Comment

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...