Hi Everyone
I have a requirement from customer to assign specific address book to all newly created customers. To achieve this, I added a post event on Insert method and am trying to assign the address book in Event handler class method.

public static void postInsertRecordHandler(XppPrePostArgs _args)
{
CustTable custTable;
CustTableEventHandler custTableEventHandler;
custTable = _args.getThis();
custTableEventHandler = new CustTableEventHandler(custTable);
custTableEventHandler.assignAddressBook();
}
public void assignAddressBook()
{
container addressBooks = ["ALL"];
DirAddressBookParty::createPartyRelationsByName(custTable.Party, addressBooks);
info(strFmt('assignAddressBook() - All addressbook assigned to %1-%2-%3-%4', custTable.AccountNum, custTable.Party, custTable.dataAreaId, custTable.RecId));
}
The code is running successfully but it is not inserting record in DirAddressbookParty table.
Will appreciate if anyone of you can let me know if I am missing anything for achieving the requirement.
Thanks in advance.
Haroon