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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

Error detected:

(0) ShareShare
ReportReport
Posted on by 123
Hello  everyone,
 I am taking extension of inventonhandqty class, 
as the given method is private in standard class, i am unable to take chain of command here, can you please help me that how it could be in such issue.
 
 
Error:
The method 'findSumWithAdvancedCriteria' can not be used as chain of command method because its target method is not protected or public in class 'InventOnHandQty'.  
Severity    Code    Description    Project    File    Line    Suppression State

Error        The method 'findSumDeltaWithAdvancedCriteria' can not be used as chain of command method because its target method is not protected or public in class 'InventOnHandQty'.  
  • Verified answer
    Martin Dráb Profile Picture
    240,776 Most Valuable Professional on at
    The error message is right - creating an extension for this method isn't possible, because the method is private.

    The fact that you declare the extension method as protected is irrelevant. What counts is whether the standard method allows extensions or not.
  • Verified answer
    Shooowtek Profile Picture
    845 on at
    Hello,
     
    You can't extend a private method. You must find another place to apply your modifications.
  • Suggested answer
    M_R Profile Picture
    123 on at
    can you please suggest me that how it should be done in this case 
    [ExtensionOf(classstr(InventOnHandQty))]
    final class ABCInventOnHandQty_Extension
    {
        //InventOnHandCompositeCriteria   advancedCriteria;
        public InventQtyAvailOrdered availOrdered(boolean _inclAvailPhysical)
        {
            next availOrdered();
            if (itemUsesWHS)
            {
                this.setInventSum();
                this.setAvailability();
                return _inclAvailPhysical ? inventSum.AvailOrdered : inventSum.AvailOrdered - inventSum.AvailPhysical;
            }
            else
            {
                Qty Qty;
                ;
                Qty = (_inclAvailPhysical ? this.availPhysical() : 0) + this.ordered() + this.arrived() - this.reservOrdered();
                return (_inclAvailPhysical ? this.availPhysical() : 0) + this.ordered() + this.arrived() - this.reservOrdered();
            }
        }
        public InventSumDelta findSumDeltaWithAdvancedCriteria()
        {
            next findSumDeltaWithAdvancedCriteria();
            Query           onHandQuery;
            QueryRun        onHandQueryRun;
            InventDim       dimCriteriaLocal;
            InventDimParm   dimParmCriteriaLocal;
            
            if (inventDimId)
            {
                dimCriteriaLocal        = InventDim::find(inventDimId);
                dimParmCriteriaLocal    = dimCriteriaLocal.toDimParm();
            }
            else
            {
                dimCriteriaLocal        = inventDimCriteria;
                dimParmCriteriaLocal    = inventDimParm;
            }
            
            onHandQueryRun = new QueryRun(onHandQuery);
            onHandQueryRun.next();
            return onHandQueryRun.get(tableNum(InventSumDelta));
        }
        public InventSum findSumWithAdvancedCriteria()
        {
            next findSumWithAdvancedCriteria();
            //Query           onHandQuery;
            QueryRun        onHandQueryRun;
            InventDim       dimCriteriaLocal;
            InventDimParm   dimParmCriteriaLocal;
            if (inventDimId)
            {
                dimCriteriaLocal        = InventDim::find(inventDimId);
                dimParmCriteriaLocal    = dimCriteriaLocal.toDimParm();
            }
            else
            {
                dimCriteriaLocal        = inventDimCriteria;
                dimParmCriteriaLocal    = inventDimParm;
            }
            
            //[dimCriteriaLocal, dimParmCriteriaLocal] = this.getDimCriteriaForAdvancedQuery();
            Query onHandQuery = InventSum::newQuery(null, itemId, dimCriteriaLocal, dimParmCriteriaLocal, null);
            
            onHandQueryRun = new QueryRun(onHandQuery);
            onHandQueryRun.next();
            return onHandQueryRun.get(tableNum(inventSum));      
        }
    }
  • Verified answer
    Martin Dráb Profile Picture
    240,776 Most Valuable Professional on at
    You can extend findSumJoinDelta(). It's the only method calling findSumDeltaWithAdvancedCriteria() and it's protected.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
Martin Dráb Profile Picture

Martin Dráb 430 Most Valuable Professional

#2
CU10121822-0 Profile Picture

CU10121822-0 368

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 364 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans