Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

How to get class contract parameter value in another class ?

(0) ShareShare
ReportReport
Posted on by 207

Hi all,

I'm working on a report Cust Aging report and i customized it with a new parameter.

In DP class i m able to get this parameter value.

How could i get it also on another class used on my report ?

Regards.

  • Hammam Profile Picture
    Hammam 36 on at
    How to get class contract parameter value in another class ?
    Hi Awaxx,
     
     Did you manage to pass a new added contract parameter to CustAgingCalclulation class extension/PreProcess method in Customer Aging Report as I have the same issue? if Yes, Please share.
     
    Thanks in advance,
     
    Best regards,
     
    M.Hammam
  • Suggested answer
    Arunraj Rajasekar Profile Picture
    Arunraj Rajasekar 1,731 on at
    RE: How to get class contract parameter value in another class ?

    Hi,

    you mentioned custagingcalculation is an CustAgingReportDP class. Inside your extension class you will be able access the contract class parm methods.

    Hope below code is helpful

    [ExtensionOf(CustAgingReportDP)]
    final Class custagingcalculation  //i am using same name as your class in this example, however it should be named as CustAgingReportDP_Extension
    {
        private CustAgingReportContract custAgingReportContract;
        
        public void calculateMethod()
        {
            custAgingReportContract = this.parmDataContract() as CustAgingReportContract; 
            
            custAgingReportContract.parmAgingBuckets();//Example on calling the existing parameter
            custAgingReportContract.YOURPARMMETHOD();// here you can call the custom parameter that you have created
        }
    }

  • Awaxx Profile Picture
    Awaxx 207 on at
    RE: How to get class contract parameter value in another class ?

    Hello,

    If someone could teach me how to do it please ?

    See U.

  • Awaxx Profile Picture
    Awaxx 207 on at
    RE: How to get class contract parameter value in another class ?

    Hello alex2112 

    Yes i made an extension on custagingcalculation class to use preprocess method 

  • Arunraj Rajasekar Profile Picture
    Arunraj Rajasekar 1,731 on at
    RE: How to get class contract parameter value in another class ?

    is custagingcalculation an extension class you created for CustAging DP?

  • Awaxx Profile Picture
    Awaxx 207 on at
    RE: How to get class contract parameter value in another class ?

    Hello arunraj

    I need to use a field input (dimension) given by class DP and the contract variable on custagingcalculation class and preprocess method to delete transaction which dont have the input value.

  • Arunraj Rajasekar Profile Picture
    Arunraj Rajasekar 1,731 on at
    RE: How to get class contract parameter value in another class ?

    Hi Awaxx,

    Can you elaborate on how you are trying to use CustAgingCalculation class with CustAging DP class, that will help us to give more suggestion on linking the two classes

  • Awaxx Profile Picture
    Awaxx 207 on at
    RE: How to get class contract parameter value in another class ?

    Hi guys i tried many things but still not reach my goal

    Could someone help ?

  • Awaxx Profile Picture
    Awaxx 207 on at
    RE: How to get class contract parameter value in another class ?

    Hi GirishS 

    Not very sure how to link CustAging DP class to my CustAgingCalculation Extension with parameters

    I tried something i found like this :

    public class MyClass
    {
        // Declare the parm method
        public void parmMyParameter(str _myParameter)
        {
            // Assign the parameter value to a class member variable or use it as needed
            this.myParameter = _myParameter;
        }
    
        // Class member variable to store the parameter value
        private str myParameter;
    }
    
    And use that like here :
    
    
    MyClass myObject = new MyClass();
    
    // Set the parameter value using the parm method
    myObject.parmMyParameter("Hello World");
    
    // Get the parameter value using the parm method
    str parameterValue = myObject.parmMyParameter();
    

    But need to pass many arguments in new method to reach directly my extension class but not accessible on DP class but i m not sure

    I will dig again

    Regards

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: How to get class contract parameter value in another class ?

    It's similar to calling contract class inside the DP class to get the values.

    Create one parm method in another class - Assign the value to that parm method inside the DP class.

    Thanks,

    Girish S.

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,979 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,848 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans