Skip to main content

Notifications

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

How to Fetch UOM value

Posted on by 86
Hi Experts,
 
I am trying to fetch the value of UOM in a report but the value is coming 0. Can someone please help me what i am doing wrong. Please correct this code.
 
Thanks in advance
 
detailTmp.Currency = salesTable.CurrencyCode;            if (!UnitOfMeasureConverter::canBeConverted(            UnitOfMeasure::unitOfMeasureIdBySymbol(salesLine.SalesUnit),            UnitOfMeasure::unitOfMeasureIdBySymbol('MT'),            InventTable::itemProduct(salesLine.ItemId)))            {                detailTmp.ValueInMT = UnitOfMeasureConverter::convert(detailTmp.OrderQty,                            UnitOfMeasure::unitOfMeasureIdBySymbol(salesLine.SalesUnit),                            UnitOfMeasure::unitOfMeasureIdBySymbol('MT'),                            NoYes::Yes,                            InventTable::itemProduct(salesLine.ItemId),                            NoYes::Yes,                            true);            }
 
 
  • Martin Dráb Profile Picture
    Martin Dráb 230,149 Most Valuable Professional on at
    How to Fetch UOM value
    Let me format your code to make it easier to read:
    detailTmp.Currency = salesTable.CurrencyCode;
    
    if (!UnitOfMeasureConverter::canBeConverted(
            UnitOfMeasure::unitOfMeasureIdBySymbol(salesLine.SalesUnit),
            UnitOfMeasure::unitOfMeasureIdBySymbol('MT'),
            InventTable::itemProduct(salesLine.ItemId)))
    {
        detailTmp.ValueInMT = UnitOfMeasureConverter::convert(
            detailTmp.OrderQty,
            UnitOfMeasure::unitOfMeasureIdBySymbol(salesLine.SalesUnit),
            UnitOfMeasure::unitOfMeasureIdBySymbol('MT'),
            NoYes::Yes,
            InventTable::itemProduct(salesLine.ItemId),
            NoYes::Yes,
            true);
    }
    Which part doesn't work as expected?

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans