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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Dynamics 365 Fiance) How to run caller(parent) class method in child class static method

(0) ShareShare
ReportReport
Posted on by 16
I have to hand over some variable values to the standard class.
 
ProdJournalCheckPostProd class call InventQualityManagementCreateHandler::createProductionReportFinishedAfter static method.
 
i'm want to pass prodjournalprod rerecid value to InventQualityManagementCreateHandler::createProductionReportFinishedAfter;
 
 
 
// 
 
[ExtensionOf(classStr(ProdJournalCheckPostProd))]
final class MGPK_ProdJournalCheckPostProd_Extension
{
    /*
        create by dwkim, 생산실적 분개장 전기시 생성되는 품질주문이 모두 동일한 시리얼로 발생하는 이슈
    */
    public RefRecId mgpk_ProdRafRecid;
    public RefRecId parmProdRafRecid(RefRecId _ProdRafRecid = mgpk_ProdRafRecid)
    {
        mgpk_ProdRafRecid = _ProdRafRecid;
        return mgpk_ProdRafRecid;
    }
    void postTransLedger(JournalTransData    _journalTransData,LedgerVoucher       _ledgerVoucher)
    {
        ProdJournalProd prodJournalProd2 = _journalTransData.journalTrans();
        this.parmProdRafRecid(prodJournalProd2.recid);
        next postTransLedger(_journalTransData, _ledgerVoucher);
    }
}
 
//
 
//
 
 
//
 
 
[ExtensionOf(classStr(InventQualityManagementCreateHandler))]
final class MGPK_InventQualityManagementCreateHandler_Extension
{
    /*
        create by dwkim, 생산실적 분개장 전기시 생성되는 품질주문이 모두 동일한 시리얼로 발생하는 이슈
    */
    public RefRecId mgpk_ProdRafRecid;
    
    
    public RefRecId parmProdRafRecid2(RefRecId _ProdRafRecid = mgpk_ProdRafRecid)
    {
        mgpk_ProdRafRecid = _ProdRafRecid;
        return mgpk_ProdRafRecid;
    }
    public static void createProductionReportFinishedAfter(
        ProdTable _prodTable,
        InventQty _qtyGood,
        PdsCWInventQty _cwQtyGood)
    {       
        RefRecId callerParmRecid = 0;
        
        Args args2 = new Args();
        info(strFmt(/%1/, classId2Name(classIdGet(args2.caller()))));
       
        // 앞전 class의 전역 함수로, 앞전 클래스의 변수값 가져온다.
        if (args2.caller().name() == classStr(ProdJournalCheckPostProd))
        {
          // callerParmRecid = callerFormRun.parm .parmProdRafRecid();
        }
     
        this.parmProdRafRecid2(callerParmRecid);
        next createProductionReportFinishedAfter(_prodTable, _qtyGood, _cwQtyGood);
    }
}
I have the same question (0)
  • Verified answer
    GirishS Profile Picture
    27,827 Moderator on at
    Seems "createProductionReportFinishedAfter" method is static method. Since its a static method, you cannot access any class methods or global variables inside this method. 
    So, you need to think of any other alternative way in achieving this functionality.
     
    Thanks,
    Girish S.
  • GirishS Profile Picture
    27,827 Moderator on at
    I can give you one suggestion for this. Just create one regular table which will store this RecId value. Just delete the records from the table while inserting inside the method . 
    Inside 'createProductionReportFinishedAfter' method you can add a select statement to the above created table to get RefRecId values.
    But you need to test this functionality end to end.
     
    Thanks,
    Girish S.
  • 동김-13080324-0 Profile Picture
    16 on at
    침hi. Girish S.
     
    I think it's a good idea to put the recid value in the table you suggested. I thought of this way, too. However, I would like to hand over that recid value to the next class.
     
    As you saw, the createProductionReportFinishedAfter method is a static method.
     
    I'm stuck with this.
  • GirishS Profile Picture
    27,827 Moderator on at
    Yes, I understood, inside static method you cannot access the global variables or any other parm methods.
    From my suggestion only option will be creating tables and storing the values.
     
    Thanks,
    Girish S.
  • 동김-13080324-0 Profile Picture
    16 on at
    .hi. GirishS.
     
    I did as you answered.
     
    I put a recid value in the table and read the table in the class behind me to deal with this problem.
  • GirishS Profile Picture
    27,827 Moderator on at
    Hope the issue is resolved. Please dont forgot to mark the useful answers as verified so it will be useful for someone in the future.
     
    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

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
Martin Dráb Profile Picture

Martin Dráb 584 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 254 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans