Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

Error - Object reference not set to an instance of an object on creating the new customer address

Posted on by 101
Hi ,
I have added few custom fields to my customer address form like region, zones etc. After creating the new address, irrespective of the new fields used or not its throwing the error of object reference not set to an instance of an object . On degubbing I found the error is in DirPartyPostalAddressView class in find method. As it hit the slect statement it throws error. 
public static DirPartyPostalAddressView find(DirPartyRecId _party, LogisticsLocationRecId _location, utcdatetime _validFrom = DateTimeUtil::utcNow(), utcdatetime _validTo = _validFrom)
    {
        DirPartyPostalAddressView postalAddressView;

        select firstonly postalAddressView
            where postalAddressView.Party == _party &&
                  postalAddressView.Location == _location &&
                  postalAddressView.ValidFrom <= _validFrom &&
                  postalAddressView.ValidTo >= _validTo;

        return postalAddressView;
    }
I can figure it out some problem is there in view, but cannot rectify what is the error.  Please suggest what can I see to check for the error. 
Please note I have added the code , if it's not visible then please check the below screenshot. I get error at line 282.
  • Verified answer
    spidey1010 Profile Picture
    spidey1010 101 on at
    Error - Object reference not set to an instance of an object on creating the new customer address
    Hi, 
    The full model build and synch helped in resolving this issue. Thanks
  • Raj Borad Profile Picture
    Raj Borad 494 on at
    Error - Object reference not set to an instance of an object on creating the new customer address
    Hi,
     
    From Screenshot, it looks like F&O not AX.
    In AX, Many times I also faced the issue that the changes may is not reflecting as per code. I usually generate Incremental CIL to check the changes in the system.
    You can try It. Or Generate Full CIL.
     
     
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    Error - Object reference not set to an instance of an object on creating the new customer address
    It doesn't makes sense, so maybe your code doesn't match the application (and therefore you're getting wrong information about where the error is thrown from). Please recompile the application.
     
    Is it about AX 2012? If so, check whether the code runs in X++ or CIL. If CIL, rebuild CIL too.

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans