web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

The value 0 is not found in map

(0) ShareShare
ReportReport
Posted on by

while select  dirpartylocation
        where dirpartylocation.Party == this.OMOperatingUnitID
    notExists join inventLocationLogisticsLocation
        where inventLocationLogisticsLocation.InventLocation == sInventLocation.RecId
    notExists join _logisticspostaladdress
            where inventLocationLogisticsLocation.Location == _logisticspostaladdress.Location
    {
        rolesCon = _rolesMap.lookup(_logisticspostaladdress.Location);
        //Create new location
        newLogisticsLocation = LogisticsLocation::create(LogisticsLocation::find(_logisticspostaladdress.Location).Description);

 

        //Create address
        newPostalAddress.clear();
        newPostalAddress.data(logisticsPostalAddress::findByLocation(_logisticspostaladdress.Location));
        newPostalAddress.Location = newLogisticsLocation.RecId;
        newPostalAddress.insert();

getting the error like "the value 0 is not found in map" in Line 8.

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: The value 0 is not found in map

    Hi mahiims18,

    this error means that your map doesn't contain a value that would correspond to _logisticsPostalAddress.Location key.

    You can use exist method to check whether a value exists in a map, and only call lookup if the value exists. This way you can avoid the error.

    You should also be aware that your code will always result in _logisticsPostalAddress.Location being 0 on line 8, since you don't select any LogisticsPostalAddress. Instead _logisticsPostalAddress is used for notexist join.

    We don't know how you populate _rolesMap, and your code also doesn't show what you do with rolesCon. But based on all the information that you shared, you could just remove line 8 completely. It would not impact how the rest of the (shared) code works.

    docs.microsoft.com/.../gg911868(v=ax.60)

  • Community Member Profile Picture
    on at
    RE: The value 0 is not found in map

    Hi Nikolaos

    I have one more statement in my code after line 18.

    i.e newInventLocationLogisticsLocation.addEntityLocation(rolesCon, true);

    so I can't remove line 8.

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: The value 0 is not found in map

    Hi mahiims18,

    then you need to fix your code. I have explained why you get the error. Please note that I also updated my previous comment, pointing out that your _logisticsPostalAddress.Location will always be 0 once your code reaches line 8.

    Right now it's not possible to suggest exact fix to your code, there's simply not enough information available.

  • Suggested answer
    ergun sahin Profile Picture
    8,824 Moderator on at
    RE: The value 0 is not found in map

    notExists join _logisticspostaladdress means you dont have that table record so why you are using a field from that table

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 765 Super User 2025 Season 2

#2
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 743

#3
Sumit Singh Profile Picture

Sumit Singh 551

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans