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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to get the latest electronic address of each type in an efficient way

(0) ShareShare
ReportReport
Posted on by 1,979

Hi,

I want get the latest email,phone, phone is Mobile and fax for each customer regardless if it's primary or not

Currently I do 4 select statements using dirPartyContactV3Entity. Is there a better way to do this?

I have the same question (0)
  • Suggested answer
    Alireza Eshaghzadeh Profile Picture
    14,686 Super User 2025 Season 2 on at

    Hi IntegrationBeginner,

    You can use data management with standard entity "Party contacts V3" to export contact information (e.g. email and phone).

    I addition, you can use table browser for table "LogisticsContactInfoView"

    pastedimage1645380908811v1.png

  • .. Profile Picture
    1,979 on at

    Hi Alireza,

    I know what table to use, I wanted to write an efficient select statement which is to get the latest phone, latest Mobile, latest email and latest fax regardless if they are primary or not...so if there are multiple phones then I need to get the last one inserted 

    So after thinking maybe I should do sth like this

    Select maxOf(RecId),Type,isMobile from dirPartyContactV3Entity Group by Type,isMobile

    Where dirPartyContactV3Entity.partyNumber=customer.PartNumber

    Join dirPartyContactV3EntityLocal where dirPartyContactV3Entity.RecId=dirPartyContactV3EntityLocal.RecId

    And now I can get the latest Locator from dirPartyContactV3EntityLocal

    (I still didn't try it)

    Or is this more effecient

    Boolean Mobile

    Boolean phone

    Boolean fax

    Boolean email

    While select dirPartyContactV3Entity order by recId desc Where dirPartyContactV3Entity.partyNumber=customer.PartNumber

    {

       If(type=email and email = false)

      {

         Take locator value

          Email = true

      }

    Else If(type=fax and fax = false)

      {

         Take locator value

          fax=true

      }

    Else If(type=phone and IsMobile=false and  phone = false)

      {

         Take locator value

         Phone = true

      }

    Else If(type=phone and Ismobile=true and mobile = false)

      {

         Take locator value

         Mobile= true

      }

    Else

    {

    Continue;

    }

    }

     

  • Suggested answer
    Alireza Eshaghzadeh Profile Picture
    14,686 Super User 2025 Season 2 on at

    Hi,

    You can find ValidTo from LogisticsContactInfoView table and you can use "CreatedDateTime" from DirPartyContactEntity table for this pupouse.

  • .. Profile Picture
    1,979 on at

    Hi,

    Why would I need the valid to, this is an electronic address not postal address. I think all electronic addresses are valid

    Again the question was to get that latest phone out of the 4 phones listed..same goes for Mobile fax and email

    And I wanted to do an efficient select statement..so which one is more efficient out of the two options I listed in the previous answer (join and group By OR the while)

  • Suggested answer
    Alireza Eshaghzadeh Profile Picture
    14,686 Super User 2025 Season 2 on at

    Have you checked the CreatedDateTime on DirPartyContactEntity table? then, you can sort contacts information based on their types and get the latest one.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 669 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 449 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 384 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans