AIF document service jobs/info

Job to execute/process messages
static void AifTestRun(Args _args)
{
    // inbound messages
    new AIFGatewayReceiveService().run();
    new AIFInboundProcessingService().run();
    // outbound messages
    new AIFOutboundProcessingService().run();
    new AIFGatewaySendService().run();

    info("done");
}
Example of "read" outbound:
static void AifTest(Args _args)
{
    AxdSendContext axdSendContext = AxdSendContext::construct();
    AifEntityKey aifEntityKey = AifEntityKey::construct();
    Map keyData;
    AifConstraintList aifConstraintList = new AifConstraintList();
    AifConstraint aifConstraint = new AifConstraint();

    VendInvoiceInfoTable vendInvoice;
    XMLDocPurpose _xMLDocPurpose = XMLDocPurpose::Original;
    AifSendMode _aifSendMode = AifSendMode::Async
    ;
    select firstOnly vendInvoice
        order by RecId desc
        where vendInvoice.PurchId == 'BHF-000060';

    keyData = SysDictTable::getKeyData(vendInvoice);

    aifEntityKey.parmTableId(vendInvoice.TableId);
    aifEntityKey.parmRecId(vendInvoice.RecId);
    aifEntityKey.parmKeyDataMap(keyData);

    axdSendContext.parmXMLDocPurpose(_xMLDocPurpose);
    axdSendContext.parmSecurity(false);

    aifConstraint.parmType(AifConstraintType::NoConstraint) ;
    aifConstraintList.addConstraint(aifConstraint) ;

    AifSendService::submitDefault(
        classnum(VendInvoiceService),
        aifEntityKey,
        aifConstraintList,
        _aifSendMode,
        axdSendContext.pack());

    info("done");
}
Example of "find" outbound. Export all records by query:
static void VKVend(Args _args)
{
    VendTable           vendTable;
    AxdSendContext      axdSendContext      = AxdSendContext::construct();
    AifEntityKey        aifEntityKey        = AifEntityKey::construct();
    AifConstraintList   aifConstraintList   = new AifConstraintList();
    AifConstraint       aifConstraint       = new AifConstraint();
    AifEndpointList     endpointList;
    AifActionId         actionId;
    Query               query;
    QueryBuildDataSource    qbds;

    query               = new Query(queryStr(AxdVendTable));
    AxdSend::removeChildDs(query);

    actionId            = AifSendService::getDefaultSendAction(classnum(VendVendTableService), AifSendActionType::SendByQuery);
    aifConstraint.parmType(AifConstraintType::NoConstraint);
    aifConstraintList.addConstraint(aifConstraint) ;
    endpointList        = AifSendService::getEligibleEndpoints(actionId, aifConstraintList);

    AifSendService::SubmitFromQuery(actionId,endpointList,query,AifSendMode::Async);
}
In case of changes and adding new services:
  • Forward compile of modified AxBC class
  • Incremental CIL
  • Restart AOS
  • AX Client config > tab:Connection >button:Refresh configuration
Also form AifService which is not available from menu. Open click Refresh button.
For error System Administration -> Periodic -> Services and Application Integration Framework -> Exceptions

Query based document services: if query is changed then relevant objects/artifacts should be updated (Tools->Application integration->Update document service)

If something is not importing/exporting truncate table AifResourceLock

// Note: For debugging
\Classes\AifInboundProcessingService\runAsUserInPartition
File name generation for a file adapter
\Classes\AifFileSystemSendAdapter\getNewOutFileName

 

Search

About

DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.

Authors are allowed to set their own AdSense units and "buy me a coffee" link.
Join us.

Blog Tags