Wednesday, September 4, 2019

Deleting Customer Business Address Primary

static void GH_Cust_BusinessAddress_Delete(Args _args)
{
    CustTable                      cust;
    DirPartyLocation               dirPartyLocation;
    LogisticsElectronicAddress     elecAddress;
    LogisticsElectronicAddressRole elecAddressRole;
    LogisticsLocationRole          locRole;

 while select  cust
    {   // where cust.AccountNum == '‪‪‪C-04474';
      ttsBegin;
        while select DirPartyLocation
            where dirPartyLocation.party == cust.Party
           {
               while select forUpdate elecAddress
                where elecAddress.Location == dirPartyLocation.Location
                   && elecAddress.Type == LogisticsElectronicAddressMethodType::Email
              {
                while select forUpdate elecAddressRole
                 where elecAddressRole.ElectronicAddress == elecAddress.RecId
                    join locRole
                    where locRole.RecId == elecAddressRole.LocationRole
                    //&& locRole.Type == LogisticsLocationRoleType::Business
                 {
                    info(strFmt("%1 - %2 - %3",cust.AccountNum, locRole.Name , elecAddress.Locator));

                    //elecAddress.delete();
                 }
             }
         }
    ttsCommit;
    }
}

No comments:

Post a Comment