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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Item exist function returns item not does not exist

(6) ShareShare
ReportReport
Posted on by 14
In some of our customised programs or classes we check if item exist using standard D365 function(see code below).
But the problem is that many times we have created the item in released product, we got return from the following function that item does not exist. It may probably like few hours to 2 days the function returns item exist.
We are puzzled why is it so.
Did anybody also encountered this issue ? 
for your info, as i debug this code, InventTableCacheFlight is enabled in our D365
 
Code
public static boolean exist(ItemId _itemId)
{
if (_itemId)
{
if (InventTableCacheFlight::instance().isEnabled())
{
SysGlobalObjectCache cache = classFactory.globalObjectCache();
container key = [curExt(), _itemId];
str scope = InventTable::cacheScope();

container result = cache.find(scope, key);
if (!result)
{
result = [InventTable::existInternal(_itemId)];
cache.insert(scope, key, result);
}
return conPeek(result, 1);
}
return InventTable::existInternal(_itemId);
}

return false;
}
Categories:
I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    300,743 Super User 2025 Season 2 on at
    Hi,

    I do think you shared the coding of the InventTable::exists method, correct? I suggest to debug this scenario where you can see if the correct itemID value is passed and what exactly gets returned.
     
    In case you created an item using X++ coding, you can overwrite the cache value. You can also bypass these methods and do a select statement on the InventTable directly from your customization.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 687 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 403 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans