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

Notifications

Announcements

Community site session details

Community site session details

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

access method variable from extension class

(0) ShareShare
ReportReport
Posted on by 680

Hi All,

I would like to access the following method variable 'wmsArrivalDetailTmpLocal' from the class extension as I will have to assign a value to this table instance before insert().

But I get an error ' The qualifier 'wmsArrivalDetailTmpLocal' is not valid ...'. I guess it is not possible to access the method variable from the extension class (using CoC). What is the alternative way? 

class WmsArrivalOverviewGeneration
...
    protected void buildInventTransId(InventTransId _inventTransId)
    {
        WMSArrivalDetailTmp     wmsArrivalDetailTmpLocal;
        InventTransOrigin       inventTransOrigin;
        InventTrans             inventTrans;
        InventDim               inventDim;
        InventQty               inProgress;
        InventQuarantineControl quarantineControl               = NoYes::No;
        boolean                 hasInitializedForTransId        = false;
        PdsCWInventQty          cwInProgress;

        wmsArrivalDetailTmpLocal.setTmpData(wmsArrivalDetailTmp);
    ...
	    wmsArrivalDetailTmpLocal.clear();
		wmsArrivalDetailTmpLocal.InventTransId      = _inventTransId;
		wmsArrivalDetailTmpLocal.InventTransType    = inventTransOrigin.ReferenceCategory;
		wmsArrivalDetailTmpLocal.InventTransRefId   = inventTransOrigin.ReferenceId;
	...

Thank you. 

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    238,149 Most Valuable Professional on at

    It's impossible - it's a method local to to buildInventTransId() and you can't access it in any way. CoC will give you an option to run your code just before or after a method, not to access its internal state. You'll have to think of another design.

    For instance. isn't initDetailValues() a good place for your logic?

  • huijij Profile Picture
    19,811 on at

    Hi ShawnDEV,

    You can access the variable  'wmsArrivalDetailTmpLocal'  in this way:

    [ExtensionOf(classStr(WmsArrivalOverviewGeneration))]
    Final class WmsArrivalOverviewGeneration_Extension
    {
        protected void initDetailValues(
            WMSArrivalDetailTmp _wmsArrivalDetailTmp,
            ItemId              _itemId,
            boolean             _initWeightAndVolume){
            next initDetailValues(_wmsArrivalDetailTmp,_itemId,_initWeightAndVolume);
            WMSArrivalDetailTmp     wmsArrivalDetailTmpLocal;
    
            wmsArrivalDetailTmpLocal.setTmpData(wmsArrivalDetailTmp);
            Info('1212');
        }
    
    }

    8463.a.PNG

    regards

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

News and Announcements

Season of Giving Solutions is Here!

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
Abhilash Warrier Profile Picture

Abhilash Warrier 732 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

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

#3
Martin Dráb Profile Picture

Martin Dráb 289 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans