web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

delete Customer addresses

(0) ShareShare
ReportReport
Posted on by 822

Hello,

i need to delete a huge number of addresses for customers.

what is the best practice to do that?

can i delete from SQL by simply running delete statement on table LogisticsLocation?

any other idea?

Regards,

David

*This post is locked for comments

I have the same question (0)
  • David Tailor Profile Picture
    822 on at

    Thank you Crispin,

    What you mean by resetting isprimary?

    Can you send me steps please.

    Regards,

    David

  • Suggested answer
    Mahmoud Hakim Profile Picture
    17,887 on at

    Check this job

    abdulghani121.blogspot.ae/.../code-for-deleting-address-information.html

  • David Tailor Profile Picture
    822 on at

    Thank you guys for your answers.

    I have a small request:

    I need to delete all addresses for all customers except one customer account = "ABC".

    How to modify the code?

    Thank you.

    Regards,

    David

  • David Tailor Profile Picture
    822 on at

    Hi Sukrut,

    the link of job that Mahmoud sent didn;t delete addresses if they are primary.

    how to modify the code as well?

    Regards,

    David

  • David Tailor Profile Picture
    822 on at

    Hi Sukrut,

    it works. thank you.

    i have a small additional request on the code in question, how can i delete addresses of type (purpose) = "Fixed asset"?

    Regards,

    David

  • Verified answer
    Mohsin Khalid Profile Picture
    501 on at

    Hi David;

    For that make the below mod to code on Abdul Gani's blog:

    static void Delete_vendTable(Args _args)
    {
        DirPartyPostalAddressView DirPartyPostalAddressView;
        VendTable vendTable;
        CustTable  CustTable;
        LogisticsLocation location;
        ;
    
        ttsBegin;
    
        while select CustTable
        {
            info(strFmt("Customer %1",CustTable.AccountNum));
    
            while select DirPartyPostalAddressView where DirPartyPostalAddressView.Party == CustTable.Party
                                                      && !DirPartyPostalAddressView.IsPrimary                                                    
            {
                location = LogisticsLocation::find(DirPartyPostalAddressView.Location,true);
    
                if(location.validateDelete() && DirPartyPostalAddressView.locationRoles() == 'Fixed asset')
                location.delete();
            }
        }
    
        ttsCommit;
    }


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

News and Announcements

Season of Giving Solutions is Here!

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
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#2
TAHER Mehdi Profile Picture

TAHER Mehdi 3

#3
Nakul Profile Picture

Nakul 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans