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)

Get site contact details from inventsiteID

(0) ShareShare
ReportReport
Posted on by 1,270

Hi,

 Hopefully an easy one for somebody but I just cant figure this one out.  I need to be able to return the site phone number, email and fax details to a Sales Quote and Invoice report.  The starting point is the inventsiteID form the custinvoicejournal but I can't figure out how to get from that to the site details in LogisticsElectronicAddress table.  I need to map the siteId to a location value to be able to do lookups on that table.

Can anyone help me out?

Thanks

David

*This post is locked for comments

I have the same question (0)
  • Florian Hopfner Profile Picture
    2,461 on at

    By looking at the query of form InventSite, the address is displayed using the view LogisticsEntityPostalAddressView, which is joined by entity type and RecId to the InventSite. You could take a look at that view, I'm guessing you will eventually find a way to join to LogisticsElectronicAddress.

  • Verified answer
    Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    Wouldn't InventSite.getLocationFromRole() help you?

  • Verified answer
    David Rose Profile Picture
    1,270 on at

    Thanks for your assistance Martin and  FH-Inway,

     I've been battling this all day and I've managed to finally find a solution that works.  I use the InventSite.getLocationFromRole() to return the logistics location of the site.  However, I found that the logisticslocation table is setup so that the contact details are actually child records of the site location that is returned from that method.   To look up the individual locators for a site I used the following  where _parentRecID is the location.recID returned by getLocationFromRole().  The _type is whatever LogisticsElectronicAddressMethodType type you are looking for.

        LogisticsElectronicAddress  logisticsElectronicAddress;

       LogisticsLocation           logisticsLocation;

       if (_parentRecID )

       {

          select logisticsLocation  

               where  logisticsLocation.ParentLocation == _parentRecID

               join logisticsElectronicAddress

                   where logisticsElectronicAddress.Type     == _type  &&

                       logisticsElectronicAddress.location == logisticsLocation.RecId;

       }    

       return logisticsElectronicAddress.Locator;


    I did also add in some time verification to the second where clause as follows to make sure the report picks up the details that were relavant at the time of quotaion, however the custQuotationJour.createdDateTime field seems to be blank so this wasn't working.  If any one can suggest why that would help me finish this off.

    The additional selects were

    (logisticsElectronicAddress.ValidTo   > _transDateTime  || logisticsElectronicAddress.ValidTo == DateTimeUtil::maxValue()) &&
                          //logisticsElectronicAddress.ValidFrom < _transDateTime


    Thanks

    David

  • Verified answer
    David Rose Profile Picture
    1,270 on at

    Regarding the createdDate time.  This can be turned on a table level.  See the createdatetime table property.

  • nach68 Profile Picture
    115 on at

    Hi,

    How can i get recid _site from InventSiteId ?

    Thinks

  • nach68 Profile Picture
    115 on at

    i am sorry,  i have found the solution :

    inventSite::find( InventSiteId)

  • Community Member Profile Picture
    on at

    Doesn't surprise me that it took a while to figure this out, at best the way that address and contact information is related to Site is very non-intuitive.  If you are still using InventSite.getLocationFromRole() note that even though it has a TransDateTime parameter it doesn't use it so there is the potential to get an inactive address, or if you are looking for one active on a certain date it might not get that.   (Note that it is possible that InventSite.getLocationFromRole() uses TransDateTime in your version of AX, you can easily check that by looking at the source code for it).    Here is an article that attempts to take some of the mystery out of getting from Site to address and contact information for AX2012, and has some code that could help that you are free to use http://hyperdaptive.com/2016/04/320/ .       

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