DirParty Cleanup

There are times, especially pre go-live when you are importing data into the system and need to clean things up. Recently I needed to remove some customers and associated contact, but I found the dirpartytable records were not completely cleaned up. The following script was used to clean up the DirPartyTable table:

static void Job_DirPartyCleanup(Args _args)
{
DirPartyTable     DirPartyTable;
SysOperationProgress    op;
;

op = new SysOperationProgress();
Select count(recid) from DirPartyTable;
op.setTotal(DirPartyTable.recid);

While
Select * from DirPartyTable
{
op.incCount();
if(DirParty::canDeleteParty(DirPartyTable.recid, true))
{
DirParty::autoDeleteParty(DirPartyTable.recid);
}
}
}

As with all manual data manipulates, ensure you take a data backup prior to running any scripts to protect your environment.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s