Berikut Script AX 2009 untuk buat vendor baru. Penamaannya agak beda dengan customer ternyata....
static void Services_VendTable_Create(Args _args)
{
// vendor Service class
VendVendTableService vendService;
VendVendTable vendor;
// Data object of Service class
VendVendTable_VendTable vendTable;
AifEntityKeyList entityKeyList;
AccountNum accountNum;
;
//Service instance
vendService = VendVendTableService::construct();
vendor = new VendVendTable();
vendor.createVendTable();
vendTable = vendor.parmVendTable().addNew();
vendTable.parmAccountNum("001");
vendTable.parmName("Vend_Service");
vendTable.parmVendGroup("LAIN-LAIN");
vendTable.parmCurrency("IDR");
vendTable.parmPartyType(DirPartyType::Organization);
// Create vendor
entityKeyList = vendService.create(vendor);
if(entityKeyList)
accountNum = entityKeyList.getEntityKey(1).parmKeyDataMap().lookup(fieldnum(VendTable, AccountNum));
infolog.messageWin().addLine(accountNum);
}
{
// vendor Service class
VendVendTableService vendService;
VendVendTable vendor;
// Data object of Service class
VendVendTable_VendTable vendTable;
AifEntityKeyList entityKeyList;
AccountNum accountNum;
;
//Service instance
vendService = VendVendTableService::construct();
vendor = new VendVendTable();
vendor.createVendTable();
vendTable = vendor.parmVendTable().addNew();
vendTable.parmAccountNum("001");
vendTable.parmName("Vend_Service");
vendTable.parmVendGroup("LAIN-LAIN");
vendTable.parmCurrency("IDR");
vendTable.parmPartyType(DirPartyType::Organization);
// Create vendor
entityKeyList = vendService.create(vendor);
if(entityKeyList)
accountNum = entityKeyList.getEntityKey(1).parmKeyDataMap().lookup(fieldnum(VendTable, AccountNum));
infolog.messageWin().addLine(accountNum);
}
No comments:
Post a Comment