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

Community site session details

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

Need help on COC

(0) ShareShare
ReportReport
Posted on by 424

Hello everyone,

I am new to COC and need a suggestion. I have static method  with some variables and I have implemented COC on same method. 

My question here is, is there any way to access the variables from original method ? 

protected static void packItem()

{

      WHSSerialId serialId;
      WHSCreateSerialNumber whsCreateSerialNumber;

   //Logic

}

now have created a new class/method.

[ExtensionOf(tableStr(TableName))]
public final class WHSContainerTableDbt_Extension
{

     protected static void packItem()

    {

         next packItem()

        //Logic

        //I need variable whsCreateSerialNumber in this method 

}

Please help 

I have the same question (0)
  • Verified answer
    Sergei Minozhenko Profile Picture
    23,093 on at
    RE: Need help on COC

    Hi Anjaneya,

    No, you can't access method variables from the original method in CoC method. You need to find another way how to implement your requirement or create an extensibility request to add an extension point for your requirement.

    Maybe if you can share your requirement, you can get help on how to achieve it in a different way.

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Need help on COC

    Method variables exist only inside the method. CoC extension is outside the method and can't see the method variables.

    As Sergei mentioned, you need to find another way to solve your business requirement.

  • Anjaney Profile Picture
    424 on at
    RE: Need help on COC

    Thank you so much, Now I look for some other options to achieve the required functionality.  

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,100

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 633 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans