Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

Customer Delivery Postal Address

Posted on by 502

Hi All,

I have updated the delivery postal address of a customer and now i am printing in Invoice from Project management >  Project Invoice.

But after updating the customer delivery address also, its not reflecting the updated address. Its reflecting the old address only. 

Can anyone help how can we reflect the updated customer address.

Thanks and regards 

Siddhant Singh

  • Siddhant Singh Profile Picture
    Siddhant Singh 502 on at
    RE: Customer Delivery Postal Address

    Thanks Andre, Its working fine. Enjoy your vacations.

  • Verified answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 287,986 Super User on at
    RE: Customer Delivery Postal Address

    Hi Siddhant,

    I think it comes from the Funding source. Path: Project contract > Funding source > Details. When you update a customer address, this funding source address is not updated automatically.

    If changing this address is not working for new invoice proposals, you can review during the invoice process where the address is taken from with help of the debugger. I don't have an environment available as I'm enjoying a vacation. You can review if the address is picked during the proposal process or when posting the project invoice. When the address is retrieved, you can review the logic where the address is defaulted from.

  • Suggested answer
    udaY-ch Profile Picture
    udaY-ch 4,616 on at
    RE: Customer Delivery Postal Address

    Hi Sid

    Guessing the customer address is updated. You need to create event handler to insert the address into CustAddress from customer address of type delivery.

    Class PSAProjInvoiceHeaderTmpEventHandler    
    {        
        [DataEventHandlerAttribute(tableStr(PSAProjInvoiceHeaderTmp), DataEventType::Inserting)]        
        public static void PSAProjInvoiceHeaderTmpInsertEvent(Common c, DataEventArgs e)        
        {           
            PSAProjInvoiceHeaderTmp tempTable = c;              
            CustTable custTable = CustTable::find(tempTable.CustAccountNum);              
            tempTable.CustAddress = Dirparty::GetpostalAddressbytype(custTable.party, LogisticsLocationRoleType::Delivery);        
        }    
    }

    Uday

  • Siddhant Singh Profile Picture
    Siddhant Singh 502 on at
    RE: Customer Delivery Postal Address

    Hi Uday,

    After Updating customer address, it should be shown on the report of new invoice that get posted.

    Thanks and regards

    Siddhant Singh

  • udaY-ch Profile Picture
    udaY-ch 4,616 on at
    RE: Customer Delivery Postal Address

    Hi,

    Where do you want to see the updated customer delivery address?

    Uday

  • Siddhant Singh Profile Picture
    Siddhant Singh 502 on at
    RE: Customer Delivery Postal Address

    Hi Uday,

    Even the new invoices also not showing the updated Address.

    Below code show, its selecting firstonly.

    public static LogisticsPostalAddress findRecId(
        RecId   _recId,
        boolean _update = false,
        utcdatetime _validFrom = DateTimeUtil::minValue(),
        utcdatetime _validTo = DateTimeUtil::maxValue())
    {
        LogisticsPostalAddress logisticsAddress;
    
        if (_recId)
        {
            logisticsAddress.selectForUpdate(_update);
    
            select firstonly validtimestate(_validFrom, _validTo) logisticsAddress
                where logisticsAddress.RecId == _recId;
        }
        return logisticsAddress;
    }

    Can we get address using primary address.

    Thanks and resgards

    Siddhant Singh

  • udaY-ch Profile Picture
    udaY-ch 4,616 on at
    RE: Customer Delivery Postal Address

    Hi Sid

    As said before, standard report derives CustAddress from ProjInvoiceJour table. The table will have the old reference

    of the Delivery postal address. For upcoming project invoices, new delivery address will be used automatically when creating the project invoice.

    "This customization is required to show the new delivery postal address for the old project invoices which will have old delivery address." If the business is okay to see the new delivery postal address for the upcoming project invoices then fine we don't need this customization at all.

    This customization will also help in case of the delivery address change in the future. (Only for project invoice report)

    Uday

  • Siddhant Singh Profile Picture
    Siddhant Singh 502 on at
    RE: Customer Delivery Postal Address

    HI Uday,

    Do we really need to customize this. As there must me functionality in which new address gets updated when we do any change.

    Thanks and regards

    Siddhant Singh

  • udaY-ch Profile Picture
    udaY-ch 4,616 on at
    RE: Customer Delivery Postal Address

    Hi

    Try this,

    custTable = CustTable::find(tmpPSAProjInvoiceHeader.CustAccountNum);

    tmpPSAProjInvoiceHeader.CustAddress = Dirparty::GetpostalAddressbytype(custTable.party, LogisticsLocationRoleType::Delivery);

    Uday

  • Siddhant Singh Profile Picture
    Siddhant Singh 502 on at
    RE: Customer Delivery Postal Address

    Hi Andre,

    I have inserted a new record in LogisticsPostalAddress from Cusromer > Address > Delivery address.

    But when i am going to post the new invoice. The new inserted address is not picked up. Also i have set the address to primary.

    Below is the code to fetch the customer address in report.

    tmpPSAProjInvoiceHeader.CustAddress = LogisticsPostalAddress::findRecId(projInvoiceJour.DeliveryPostalAddress).Address;

    My requirement is that it should pick up the new inserted address. How can i achieve it.

    Thanks and regards

    Siddhant Singh

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,986 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,588 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans