Hi
I have a requirement of updating the Email address field of contact information for each store number in Retail module , i tried with different jobs but i am not getting the Expected result.
Job that i created in AX2012:
DirPartyTable dirparty;
DirPartyLocation dirPartyLocation;
LogisticsElectronicAddress elecAddress;
LogisticsElectronicAddressRole elecAddressRole;
LogisticsLocationRole locRole;
RetailChannelTable rct;
RetailStoreTable rst;
CustTable cust = CustTable::find('9999999');
//while select cust
// where cust.AccountNum != " "
//{
select forUpdate firstOnly elecAddress
where elecAddress.Location == DirPartyLocation::findOrCreate(cust.Party, 0).Location
&& elecAddress.Type == LogisticsElectronicAddressMethodType::Email
//&& elecaddress.IsPrimary==NoYes::Yes
join rct where rct.DefaultCustAccount==Cust.AccountNum
join rst where rst.RecId==rct.RecId
&& rst.StoreNumber=="6903";
if (elecAddress.RecId)
{
info(strFmt("%1 , %2 - email - %3", rst.StoreNumber, cust.name(),elecAddress.Locator));
ttsBegin;
elecAddress.Type = LogisticsElectronicAddressMethodType::Email;
elecAddress.Locator = 'apr@xxx.com';
elecAddress.update();
ttsCommit;
info(strFmt("%1 , %2 - email - %3", rst.StoreNumber, cust.name(),elecAddress.Locator));
}
Hi mahiims18,
Can you tell what is currently wrong with this attempt? Do you get an error? What is the current behavior? Did you use the debugger to find out where you possibly need to adjust the script?
Your requirement is about updating email addresses for all stores, but you are selecting only one.
Moved to the AX2012 forum.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156