Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Updating email address for all stores in Retail module

Posted on by Microsoft Employee

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));
}

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,240 Super User 2024 Season 2 on at
    RE: Updating email address for all stores in Retail module

    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.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,240 Super User 2024 Season 2 on at
    RE: Updating email address for all stores in Retail module

    Moved to the AX2012 forum.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans