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)

DEV-AX: help request from experienced AX developer for some AX architecture guidance

(0) ShareShare
ReportReport
Posted on by 7,437

Hi,

I am looking into how to integrate with AX so that my order download can be automated. I have strong background in OO design and I see AX is not having a basic design/ architecture principles which I can follow. I see a mix of middle tier between Business Layer, GUI layer and database layer. Not talking about MVC design pattern and unit testing against it. I need some help here in sorting out what is useful.

I basically want to download Sales order in trunks of Customer, Sales Order data, Address, Payment data and Sales order lines. I can call my webservices to deliver the data. That works fine. However, building the data in AX is quite a puzzle. I see some design pattern in the SalesOrder creation build against inheritance or interfaces..but many of the code is duplicated (!!!! with is certainly not in any design pattern and in particular not OO).

Since the code is between tables, forms, various gui's and not in a business or datalayer class it is hard to see an entry point where I can start OO coding by reusing much of existing functionality and thus be a bit safe for changes in the underlying architecture.

If I look at the AIF (which is an entrypoint created by MS) I cannot see what the Customer service does. I can use it in AX++ code to call, nor see its internal code. It does not seem to create entry in Address table for invoice and delivery address etc. It is more a mapping to a table (DAL) than a BAL (business access layer).

I have the feeling I cannot hook into any object. I was thinking of calling the Address form since most logic is there (where you would not expect it!). But then you get into a jungle or spaghetti mix since the Address form expects some caller from a main form and can hard exist on itself. Also I do not know if Forms can be created server side on the AOS?

J.

*This post is locked for comments

I have the same question (0)
  • user5555 Profile Picture
    7,437 on at

    Friendly bump.

    I have some help offpost...but some more help is appreciated.

  • user5555 Profile Picture
    7,437 on at

    Hi,

    Next data I cannot insert/update in a proper way:

    1. Address information (primairy, delivery, invoice);

    2. Contact data like 'birthdate' etc. (update)

    3. ECommunication like phone number, username (own field) and

    4. Misc. charges.

    Any help appreciated.

    J.

  • user5555 Profile Picture
    7,437 on at

    Three options:

    1. Nobody has challenged DirParty table so far? I admit: this AX code is really hard to understand. It is one complete 'spaghetti-loop' ready for a new architectural approach.
    2. There are no experienced developers here?
    3. Or there are, but not willing to help?

    1. Address information (primairy, delivery, invoice);

    ==> Implemented. Take care you do not touch too much custTable data fields since they will trigger various initfrom(..) which on it turn inserts fields and relationships you might not want.. Saying CustTable.CountryRegionId = 'a value' already fills in DirParty with all related tables towards a primairy address...very handy :-(.

    2. Contact data like 'birthdate' etc. (update)

    ==> To-do.

    3. ECommunication like phone number, username (own field) and

    ==> To-do.

    4. Misc. charges.

    ==> IMplemented. Table called is MarkUpTable and MarkUpTrans is used for the data per salesorder.

    I guess 2 and 3 will require same approach as 2. Which I do not like, but it works.

    J.

  • Mohamed Amine HAMDAOUI Profile Picture
    540 on at

    Hi,

    I really don't understand your need. What do you want to do exactely?

    From my understanding, you have a webservices witch deliver data and you want to import them into AX. You can export them as a spreedsheet and import them via the administration menu. Is this what you want to do?

    Best Regards,

    --------------------
    Mohamed Amine HAMDAOUI
    Dynamics Ax Technical Consultant
    Vi-One North Africa - VISEO Group
    Mail : mhamdaoui@viseo.net

     

     

     

  • user5555 Profile Picture
    7,437 on at

    Hi,

    Thank you for your reply. I want my webservices to inject directly into AX (I got merge functionality on my website which checks for duplicates). I have done this for customer, addresses, salesorderline, misc. charges, check on balance total, but I miss the contact information like email, phone numbers, username (own defined communication) and I miss the birthdate and gender injection. I certainly do not want to create Excels since the webshop has next-day delivery :-). I even want to move my webservice into a job/ batch? and have it processed every minute. Last but not least I want to inject the prepayment done by the customer online ( I will create other post for it).

    J.

    // Global::info(custTable.Name + " - " + custTable.AccountNum);

                   // Party
    /*               if (!custTable.PartyId)
                   {
                        custTable.PartyId = DirParty::createPartyFromCommon(custTable).PartyId;
                    }
                    else
                    {
                        dirParty = DirParty::constructFromPartyId(custTable.PartyId);
                        dirParty.parmAnniversaryDate(customer.get_BirthDay());
                        dirParty.parmGender(Gender::Male);
                        DirParty::updateCommInfoFromParty(dirParty);
                        //DirParty::updatePartyFromCommonInsert(custTable.PartyId, custTable);
                    }
    */
                    //Global::info(custTable.PartyId);
                    //debug

     

            //dirParty.
    //                //dirParty.parmAnniversaryDate(customer.get_BirthDay());

                   // dirParty = new DirParty(CustTable);

                //    dirParty.initFromCustTable(custTable);
                    //redundant dirParty.initializePersonInfo();

               //     tempCLRObject = customer.get_BirthDay();
               //     if(tempCLRObject)
               //         dirParty.parmBirthDate(tempCLRObject);

              //   custTable.update(false, true);


    //                dirParty.updateCommonFromDirparty(dirParty.getTableId());

                   // dirParty.parmGender(Gender::Female);
                    //dirParty.updateCommonFromDirparty(custTable.TableId);
                    //DirParty::updatePartyFromCommon(custTable.PartyId, custTable);

    //                tempCLRObject = customer.get_Cell();

        //fieldId = DirECommunicationAddress::type2FieldId(DirECommunicationTypeTable::find(this.eCommunicationTypeId).MethodType);

      //              dirECommunicationTypeTable = DirECommunicationTypeTable::findBySystemType(DirSystemECommunicationType::CellularPhone, true);
        //            if(!dirECommunicationTypeTable)
          //          {
            //            dirECommunicationTypeTable.initValue();
    //        //            dirECommunicationTypeTable.
                //        dirECommunicationTypeTable.insert();
                  //  }
    //                dirECommunicationAddress.initValue();
      //              dirECommunicationAddress.initFromDirParty(dirParty, DirSystemECommunicationType::CellularPhone);
    //                dirECommunicationAddress. = DirSystemECommunicationType::CellularPhone;
          //          if(tempCLRObject)
    //                    dirECommunicationAddress.editCommunicationValue(true, tempCLRObject);
      //              else
        //                dirECommunicationAddress.delete();

            //        dirECommunicationAddress.update(true);
    //
    ////                                dirECommunicationAddress.initFromDirParty(dirParty, DirSystemECommunicationType::CellularPhone);
    ////                                                                dirECommunicationAddress.initFromDirParty(dirParty, DirSystemECommunicationType::PrimaryPhone);
    ////                                                                dirECommunicationAddress.initValue();
    ////
    //                    { //no match found --> update webserver merge state.
    //
    //                        Global::warning("Invoice address not found");
    //                        //soapClient.UpdateAddressSyncState(credentialSoapHeader, addressId, bBaytDataExchangeServer.SyncStateEnum::SyncError);
    //                        //soapClient.UpdateSalesOrderSyncState(credentialSoapHeader, salesOrderId,  bBaytDataExchangeServer.SyncStateEnum::SyncError);
    //                        //addressMap
    //                    }
    //                    else
    //                    {
    //                        addressInvoice = addressMap;
    //                     }
    //                    //AddressMap::
    //                    //AddressZipCode::findBestMatch(
    //            }

            try
            {
                 salesOrderLines = soapClient.GetSalesOrderLinesBySalesOrderId(credentialSoapHeader, salesOrderId);
            }
            catch(Exception::CLRError)
            {
                Global::error("GetSalesOrderLinesBySalesOrderId through webservice failed for %1.");
                throw error(AifUtil::getClrErrorMessage());
            }

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
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans