Skip to main content

Notifications

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 14
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);
    }
}
  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    Dynamics 365 Fiance) How to run caller(parent) class method in child class static method
    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.
  • Dynamics 365 Fiance) How to run caller(parent) class method in child class static method
    .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
    GirishS 27,821 Super User 2024 Season 1 on at
    Dynamics 365 Fiance) How to run caller(parent) class method in child class static method
    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.
  • Dynamics 365 Fiance) How to run caller(parent) class method in child class static method
    침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
    GirishS 27,821 Super User 2024 Season 1 on at
    Dynamics 365 Fiance) How to run caller(parent) class method in child class static method
    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.
  • Verified answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    Dynamics 365 Fiance) How to run caller(parent) class method in child class static method
    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.

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…

Vahid Ghafarpour – Community Spotlight

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

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,162 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans