web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to send multiple messages for the same InventTable record using AIF outbound AX2012

(0) ShareShare
ReportReport
Posted on by 3,248

Hi

I am new to AIF , i have deployed a outbound port and using file system adapter.

Requirement is:

Whenever a new product A001 is created , i trigger a message(XML) to send to an External system using outbound port . XML message has a node status with value NEW for newly created product. example

Like : <status> NEW </status> , once the product is created it is added to the Queue.

Next time when a released product is modified , say you update a inventory unit, on released product form , a new message is triggered with the status updated.

Issue:  When user creates a new product, 1 messages is moved to queue and it remains there unless user has not run the JOB to  move the message outside AX , after that when user updates/modifies a field on the same released product , the new message overrides the 1st message, and QueueManager allows only one record at any point of time, for that product. how do i make sure that Queue Allows multiple records or process the 1st message before second message is put into the queue?


I have written send electronically method on Inventtable table and calling it from insert and update method.
server void sendElectronically(XMLDocPurpose _xmlDocPurpose, AifSendMode _aifSendMode = AifSendMode::Async)
{
    AxdSendContext      axdSendContext = AxdSendContext::construct();
    AifEntityKey        aifEntityKey   = AifEntityKey::construct();
    Map                 keyData;
    AifConstraint       aifConstraint = new AifConstraint() ;
    AifConstraintList   aifConstraintList = new AifConstraintList();
    ;
    keyData = SysDictTable::getKeyData(this);

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

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

   // aifConstraint.parmType(AifConstraintType:);
    aifConstraint.parmId(this.ItemId);
    aifConstraintList.addConstraint(aifConstraint);

    AifSendService::submitDefault(
    classNum(InventItemService),
    aifEntityKey,
    aifConstraintList,
    _aifSendMode,
    axdSendContext.pack());
}


running below job for testing purpose to process the messages outside AX.

static void DAXProcessAIF(Args _args)
{
      //Outbound
    new AifOutboundProcessingService().run();   // process messages in queue
    new AifGateWaySendService().run();          // send messages*/

    info('Done');
}

is it a good idea to put below lines.

new AifOutboundProcessingService().run();   // process messages in queue
    new AifGateWaySendService().run();

in send electronically method?


    AxdSendContext      axdSendContext = AxdSendContext::construct();
    AifEntityKey        aifEntityKey   = AifEntityKey::construct();
    Map                 keyData;
    AifConstraint       aifConstraint = new AifConstraint() ;
    AifConstraintList   aifConstraintList = new AifConstraintList();
    ;
    keyData = SysDictTable::getKeyData(this);

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

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

   // aifConstraint.parmType(AifConstraintType:);
    aifConstraint.parmId(this.ItemId);
    aifConstraintList.addConstraint(aifConstraint);

    AifSendService::submitDefault(
    classNum(InventItemService),
    aifEntityKey,
    aifConstraintList,
    _aifSendMode,
    axdSendContext.pack());

*This post is locked for comments

I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans