Skip to main content

Notifications

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
    Martin Dráb 230,817 Most Valuable Professional on at
    Error detected:
    You can extend findSumJoinDelta(). It's the only method calling findSumDeltaWithAdvancedCriteria() and it's protected.
  • Suggested answer
    M_R Profile Picture
    M_R 123 on at
    Error detected:
    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
    Shooowtek Profile Picture
    Shooowtek 737 on at
    Error detected:
    Hello,
     
    You can't extend a private method. You must find another place to apply your modifications.
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,817 Most Valuable Professional on at
    Error detected:
    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.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,817 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans