Santosh.'s profileDynamics AxPhotosBlogLists Tools Help

Blog


    September 18

    Talking about Adding extra elements to XML string in AIF

     

    Hi, I recently found a very good article from Sumit Loya's Blog on AxD  "How extra elements can be added to the XML string in AIF".

    Thanks a lot Sumit for this wonderful articleSmile.

    Quote 

    Adding extra elements to XML string in AIF
    September 11

    How to perform Inbound & Outbound without AIF setup

     

    Hi......For sending/receiving any XML the Dynamics AIF Framework is used. There is an alternate way of doing the same operation without AIF setup. Please find the below examples for all the actions.

     

    Example: Read  

    static void VendorOutbound(Args _args)

    {

        AxdVendTable                    axdVendTable;

        AifEntityKey                       entityKey       = new AifEntityKey();

        AifPropertyBag                   aifPropertyBag;

        VendTable                          vendTable;

        XmlDocument                     xmlDocument = new XmlDocument();

        ;

        select firstonly vendTable;

        entityKey.parmKeyDataMap(SysDictTable::getKeyData(vendTable));

        axdVendTable = AxdBase::newClassId(classnum(AxdVendTable));

        xmlDocument.loadXml(axdVendTable.read(entityKey, null, new  AifEndpointActionPolicyInfo(), new AifConstraintList(), aifPropertyBag));

        xmlDocument.save('c:\\AxdServiceOrder_Out1.xml');

    }

     

    Example: Create 

    static void createInboundProjectHourJournal(Args _args)

    {

        AxdProjectHourJournal                axdProjetcHourJournal;

        XmlDocument                             xmlDocument;

        AifEndPointActionPolicyInfo         endPointAction = new AifEndPointActionPolicyInfo();

        AifConstraintList                         aifConstraint     = new AifConstraintList();

        AifDocumentXml                         xmlDoc;

        ;

     

        xmlDocument = new xmlDocument();

        xmlDocument.load("c:\\ProjectHourCreate.xml");

        axdProjetcHourJournal = AxdBase::newClassId(ClassNum(AxdProjectHourJournal));

        xmlDoc = xmlDocument.toString();

        axdProjetcHourJournal.create(xmlDoc, endPointAction, aifConstraint);

    } 

     

    Example: CreateList 

    static void createListInboundServiceOrder_Item(Args _args)

    {

        AxdServiceOrder                         axdServiceOrder;

        XmlDocument                             xmlDocument;

        AifEndPointActionPolicyInfo         endPointAction = new AifEndPointActionPolicyInfo();

        AifConstraintListCollection           aifConstraint     = new AifConstraintListCollection();

        AifDocumentXml                         xmlDoc;

        ;

     

        xmlDocument = new xmlDocument();

        xmlDocument.load("c:\\AxdServiceOrderCreate.xml");

        axdServiceOrder = AxdBase::newClassId(ClassNum(AxdServiceOrder));

        xmlDoc = xmlDocument.toString();

        axdServiceOrder.createlist(xmlDoc, endPointAction, aifConstraint);

    }

     

    Example: Update

    static void updateInboundServiceOrder_Item(Args _args)

    {

        AxdServiceOrder                      axdServiceOrder;

        XmlDocument                          xmlDocument;

        AifEndPointActionPolicyInfo     endPointAction = new AifEndPointActionPolicyInfo();

        AifConstraintListCollection       aifConstraintC  = new AifConstraintListCollection();

        AifConstraintList                     aifConstraint    = new AifConstraintList();

        AifDocumentXml                     xmlDoc;

        AifEntityKey                           entityKey;

        ;

     

        xmlDocument = new xmlDocument();

        xmlDocument.load("c:\\axdServiceOrderInventDim.xml");

        axdServiceOrder = AxdBase::newClassId(ClassNum(AxdServiceOrder));

        xmlDoc = xmlDocument.toString();

        axdServiceOrder.update(entityKey, xmlDoc, endPointAction, aifConstraint);

    }

     

    Example: Delete

    static void deleteServiceOrder(Args _args)

    {

        AxdServiceOrder                 axdServiceOrder;

        AifEntityKey                       entityKey        = new AifEntityKey();

        AifEntityKeyList                  entityKeyList   = new AifEntityKeyList();

        AifPropertyBag                    aifPropertyBag;

        SMAServiceOrderTable        sMAServiceOrderTable;

        XmlDocument                      xmlDocument = new XmlDocument();

        ;

     

        select firstonly sMAServiceOrderTable where sMAServiceOrderTable.ServiceOrderId == '0000083_SO';

        entityKey.parmKeyDataMap(SysDictTable::getKeyData(sMAServiceOrderTable));

        axdServiceOrder = AxdBase::newClassId(classnum(axdServiceOrder));

        entityKeyList.addEntityKey(entityKey);

        axdServiceOrder.deleteList(entityKeyList , new AifEndpointActionPolicyInfo(), new AifConstraintListCollection());

    }

     

    Hope this piece of information was useful...Smile

     

    September 05

    AIF Error: The parameter schema could not be found for EndpointId

     

    The above error message will be observed in Queue Manager whenever an outbound action is performed. [Pre-requisites: AIF is configured properly for a File System Adapter]

    The above error message is because is “Data policies is not configure for the specified action/service in the Endpoint Action Policies form. So once Action policy is configure for an outbound service make sure that at least once you click Data policies so that particular ClassName, Document Name & Action gets updated in “AifEndpointActionParameterSchema” form(As shown below) .

    img356/6717/datapolicieswe1.jpg

    Now try performing an outbound action and this time you will not observed the error J J J

     
    September 02

    AIF Tit bits

     

    Most of us would have used “Send Electronically” to send data as XML across Company (or) external systems. The common Actions/Services which are used to perform an Outbound action with Application Integration Framework are

    v  findEntityKeyList

    v  findList

    v  read

    v  readList

    But do we know what is the Significance of read & findList action

    readChartOfAccounts” : If send electronically is triggered on ChartOfAccounts with the specified action/service you’ll observe the following error

    img147/7214/infologmd2.jpg

    This is because the “read” action is called on special cases like sending invoice, pickingList data. Sending electronic information as “SendXMLOriginal” or as “SendXMLDuplicate”.

     

    If Send Electronically is:

     

    Button type always use the “find” action.

    MenuButton(MenuSendXML)type always use the “read” action.

     

    For a given AxD if AxdSend class is implemented then “find” action is used.

    Similarly if DefaultSendAction is used then use "read" action. This scenario is implemented in case of Table.

     

    Hope this piece of information share was useful.