Creating a log after customer creation

Hi ,

I am creating a customer in ax2012 with address and contact information.

After creation, I need to insert the details of customer , address & contact info in a log table.

I tried to trigger the logic of log insertion from Insert method of DirpartyLocation table but It is called twice for PostalAddress & ElectronicAddress. So two records are getting inserted in log table whereas only one record should be inserted.

I even tried a Post Event handler for Insert method in DirpartLocation table but that gives the same result as above.

Any suggestion would be appreciated.

Regards,

Anitha

That insert() is called twice doesn’t mean that you have to create two records in your log table. You’re free to handle it in any way you want.

Martin,

Any suggestion on the table sequence of Customer creation with address & contact info?

I need to insert in a log table with all these details .

My plan is to trigger the log table creation from PostEventHandler of INSERT method from Dirpartylocation table.

Since it is called twice and if my logic of calling the log table is in that method, it would result in 2 records in the log.

I debugged the sequence and i found this insert method is called after postal address & electronic address.

There simply may be several records in DirPartyLocation for a single customer - it’s up to you to decide how you want to log them.

If you don’t want to create a new record in your log for every record in DirPartyLocation, just don’t do it. It was you who wrote that code. You can, for example, update a common log record from DirPartyLocation.insert(), if it makes sense in your case.

If you want to understand the data model of Global Address Book, read through Implementing the Global Address Book Framework (White paper).