Tuesday, April 26, 2011

Hapus Customer di AX 2009 menggunakan Class AIF

static void Services_CustTable_Delete(Args _args)

{
AifEntityKeyList entityKeyList;
AifEntityKey aifEntityKey;


// Data object of Service class

CustCustomerService custService;
CustTable custTable;
;

aifEntityKey = new AifEntityKey();

entityKeyList = new AifEntityKeyList();
custService = CustCustomerService::construct();

select firstonly custTable

where custTable.Name == "Cust_Service";

aifEntityKey.parmKeyDataMap(SysDictTable::getKeyData(custTable));

entityKeyList.addEntityKey(aifEntityKey);

try

{
  // Delete Customer
  custService.delete(entityKeyList);
  info ("CustTable record was successfully deleted.");
}

catch(Exception::Error)
{
   exceptionTextFallThrough();
}


}

No comments:

Post a Comment