static void updatecustomeraddress(Args _args)
{
CustTable custTable;
DirPartyTable dirPartyTable;
DirPartyLocation dirPartyLocation;
DirPartyLocationRole dirPartyLocationRole;
LogisticsLocation logisticsLocation;
LogisticsLocationRole logisticsLocationRole;
LogisticsPostalAddress logisticsPostalAddress;
while select * from custTable where custTable.AccountNum == "BRIG" // if you want vendor change here
join dirPartyTable
where dirPartyTable.RecId == custTable.Party
join dirPartyLocation
where dirPartyLocation.Party == custTable.Party
// if you want role specific un-commented below code
/*join dirPartyLocationRole
//where dirPartyLocationRole.PartyLocation == dirPartyLocation.RecId
//join logisticsLocationRole
//where logisticsLocationRole.RecId == dirPartyLocationRole.LocationRole
// && logisticsLocationRole.Type == LogisticsLocationRoleType::Delivery*/
join logisticsLocation
where logisticsLocation.RecId == dirPartyLocation.Location
join logisticsPostalAddress
where logisticsPostalAddress.Location == logisticsLocation.RecId
{
ttsbegin;
logisticsPostalAddress.selectForUpdate(true);
logisticsPostalAddress.ValidTimeStateUpdateMode (ValidTimeStateUpdate::Correction);
logisticsPostalAddress.Address = "Test address";
logisticsPostalAddress.update();
ttsCommit;
}
}
18 Oct 2018
Get Customer/Vendor address through code in AX 2012
static void getCustomerAddress(Args _args)
{
CustTable custTable;
VendTable vendTable;
DirPartyTable dirPartyTable;
DirPartyLocation dirPartyLocation;
DirPartyLocationRole dirPartyLocationRole;
LogisticsLocation logisticsLocation;
LogisticsLocationRole logisticsLocationRole;
LogisticsPostalAddress logisticsPostalAddress;
while select * from custTable where custTable.AccountNum == "BRIG" // if you want vendor specify vendor here
join dirPartyTable
where dirPartyTable.RecId == custTable.Party
join dirPartyLocation
where dirPartyLocation.Party == custTable.Party
//If you need fetch based on role use below commented code
/*join dirPartyLocationRole
//where dirPartyLocationRole.PartyLocation == dirPartyLocation.RecId
//join logisticsLocationRole
//where logisticsLocationRole.RecId == dirPartyLocationRole.LocationRole
// && logisticsLocationRole.Type == LogisticsLocationRoleType::Delivery*/
join logisticsLocation
where logisticsLocation.RecId == dirPartyLocation.Location
join logisticsPostalAddress
where logisticsPostalAddress.Location == logisticsLocation.RecId
{
info(strFmt("%1", logisticsPostalAddress.Address));
}
}
{
CustTable custTable;
VendTable vendTable;
DirPartyTable dirPartyTable;
DirPartyLocation dirPartyLocation;
DirPartyLocationRole dirPartyLocationRole;
LogisticsLocation logisticsLocation;
LogisticsLocationRole logisticsLocationRole;
LogisticsPostalAddress logisticsPostalAddress;
while select * from custTable where custTable.AccountNum == "BRIG" // if you want vendor specify vendor here
join dirPartyTable
where dirPartyTable.RecId == custTable.Party
join dirPartyLocation
where dirPartyLocation.Party == custTable.Party
//If you need fetch based on role use below commented code
/*join dirPartyLocationRole
//where dirPartyLocationRole.PartyLocation == dirPartyLocation.RecId
//join logisticsLocationRole
//where logisticsLocationRole.RecId == dirPartyLocationRole.LocationRole
// && logisticsLocationRole.Type == LogisticsLocationRoleType::Delivery*/
join logisticsLocation
where logisticsLocation.RecId == dirPartyLocation.Location
join logisticsPostalAddress
where logisticsPostalAddress.Location == logisticsLocation.RecId
{
info(strFmt("%1", logisticsPostalAddress.Address));
}
}
26 Sept 2018
Generate random numbers in AX 2012
Sometimes required generate a random number between given range.
There is a class RandomGenerate for generate random numbers.
See below example, My requirement generate random numbers with 9 digits .
static void AXExplorer_Randomnumber(Args _args)
{
RandomGenerate randomGenerate;
int randomNumber;
randomGenerate = RandomGenerate::construct();
randomGenerate.parmSeed(new Random().nextInt());
randomNumber = RandomGenerate.randomInt(100000000, 999999999); // need to specify range
info(strFmt("%1", randomNumber));
}
Subscribe to:
Posts (Atom)
Create number sequence in D365 FO
Create the data type. Add code in the loadModule method of the appropriate NumberSeqModule subclass. Add a method to the module’s paramet...
-
Dialogbutton dialogButtonConfirm; ; dialogButtonConfirm = Box::yesNo("continue ", dialogButton::Yes, ...
-
how you can disable a form element, based on the value of another form element. As example, the CustTable form will be used. The examp...
-
AXAPTA History Axapta 1.0 Development of Axapta began in 1983 at Danish company Damgaard Data A/S. The first version of Axapta (pr...