Skip to main content

Notifications

Microsoft Dynamics AX forum
Answered

Push all data of a table to read operation of AIF outbound service

Posted on by 380

HI,

I need to push all the data of a table to read operation of the AIF outbound port through x++ or any other way in AX 2012 at a time.

Thanks in advance.

Regards,

Gyan 

  • Lauras U Profile Picture
    Lauras U 947 on at
    RE: Push all data of a table to read operation of AIF outbound service

    Correct my if I am wrong, but after switching to AifSendActionType::SendByQuery is not Read anymore it's a find operation.

  • Amir Nazim Profile Picture
    Amir Nazim 5,994 on at
    RE: Push all data of a table to read operation of AIF outbound service

    please mark it is verified if this works for you, so others can also be benefited

  • Suggested answer
    gyan chand kabra Profile Picture
    gyan chand kabra 380 on at
    RE: Push all data of a table to read operation of AIF outbound service

    Thanks Amir for your response

  • Verified answer
    Amir Nazim Profile Picture
    Amir Nazim 5,994 on at
    RE: Push all data of a table to read operation of AIF outbound service

    you can use this example

    The following code is used to execute the AIF File outbound  Service using Query  for AIF find Operation.

    ex:= Sales Table-salesid,another field and call AIF find to execute query criteria.

    static void krish_OutboundAifQueryProcess(Args _args)

       {

           AxdSendContext          axdSendContext      = AxdSendContext::construct();

           AifAction               aifAction ;

           AifConstraint           aifConstraint       = new AifConstraint();

           AifConstraintList       aifConstraintList   = new AifConstraintList();

           AifOutboundProcessingService AifOutboundProcessingService =

                                                     new AifOutboundProcessingService();

           AifGatewaySendService   AifGatewaySendService = new AifGatewaySendService();

            AifActionId                 actionId;

            AifEndpointList             endpointList;

            Query                               query;

            QueryBuildDataSource      queryBuildDataSource;

           ;

           query = new Query(queryStr(AIFCRMOrderReturn));

           queryBuildDataSource = query.dataSourceTable(tablenum(EDSACRMSyncLog));

           queryBuildDataSource.addRange(fieldnum(EDSACRMSyncLog,CRMOrderId)).

                                                                                       value(QueryValue('2500591'));

           queryBuildDataSource.addRange(fieldnum(EDSACRMSyncLog,DocReturn)).

                                                                                value(QueryValue(NoYes::No));

          aifAction = AifAction::find(AifSendService::getDefaultSendAction(classnum

                  (EDSACRMOrderReturnService),AifSendActionType::SendByQuery)) ;

           axdSendContext.parmXMLDocPurpose(XMLDocPurpose::Original);

           axdSendContext.parmSecurity(false);

           aifConstraint.parmType(AifConstraintType::NoConstraint);

           aifConstraintList.addConstraint(aifConstraint) ;

           endPointList=AifSendService::getEligibleEndpoints(aifAction.ActionId,aifConstraintList);

           AifSendService::submitFromQuery(aifAction.ActionId, endpointList, query, AifSendMode::Sync);

           AifGatewaySendService.run();

           AifOutboundProcessingService.run();

       }

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Dynamics 365 Community Newsletter - August 2024

Catch up on the latest D365 Community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,186 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 227,996 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans