Berikut script untuk membuat Customer di AX 2009, dengan memanfaatkan Class AIF.
AIF nya tidak perlu di setting apapun.
static void Services_CustTable_Create(Args _args)
{
// Customer Service class
CustCustomerService custService;
CustCustomer customer;
// Data object of Service class
CustCustomer_CustTable custTable;
AifEntityKeyList entityKeyList;
AccountNum accountNum;
;
//Service instance
custService = CustCustomerService::construct();
customer = new CustCustomer();
customer.createCustTable();
custTable = customer.parmCustTable().addNew();
custTable.parmAccountNum("001");
custTable.parmName("Cust_Service");
custTable.parmCustGroup("KARY STAFF");
custTable.parmCurrency("IDR");
//custTable.parmPartyType(DirPartyType::Organization);
custTable.parmPartyType(DirPartyType::Person);
// Create Customer
entityKeyList = custService.create(customer);
if(entityKeyList)
accountNum = entityKeyList.getEntityKey(1).parmKeyDataMap().lookup(fieldnum(CustTable, AccountNum));
infolog.messageWin().addLine(accountNum);
}
No comments:
Post a Comment