Skip to main content

Notifications

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

how will I pass Recid of active record in Controller class and then in RDP class.

(0) ShareShare
ReportReport
Posted on by

Hi All,

In form grid I have record. for example 2 lines are there as below

pastedimage1683572881488v1.png

And One Print buton is there to print the report based on current record selection.

I mean If I select the 1st record , it should print the first record only. I mean 04/19/2023

If i select the 2nd record, it should print the second record only . I mean 05/08/2023

for this I need to get Recid of active record.

Kindly let me know how will I pass Recid of active record in Controller class and then in RDP class.

Please give me more shed on this.

thanks!

  • @rp@n Profile Picture
    @rp@n on at
    RE: how will I pass Recid of active record in Controller class and then in RDP class.

    No Mohit, I already replied

  • @rp@n Profile Picture
    @rp@n on at
    RE: how will I pass Recid of active record in Controller class and then in RDP class.

    Hi Mohit & Girish

    I debugged the below code

    pastedimage1683604224902v1.png

    It not getting in to the if condition.

    pastedimage1683604321650v2.png

    Pls give me more shed on this.

    thanks!

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: how will I pass Recid of active record in Controller class and then in RDP class.

    No, it won't be because of that, Are you getting buffer in custInvoiceDuplicateTable in prePromtModifyContract method?

  • @rp@n Profile Picture
    @rp@n on at
    RE: how will I pass Recid of active record in Controller class and then in RDP class.

    Hi Mohit,

    I tested with 1st record but got the RecId  = 0

    Is it because of I not declared recId as public?

    Or any other reasons?

    pls give me more shed on this.

    thanks!

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: how will I pass Recid of active record in Controller class and then in RDP class.

    Yes, Public RecId parmRecId will be at top of your extension class.

  • @rp@n Profile Picture
    @rp@n on at
    RE: how will I pass Recid of active record in Controller class and then in RDP class.

    you mean to say

    RecId     recId;

    recId = contract.parmRecId();

    is it correct?

  • @rp@n Profile Picture
    @rp@n on at
    RE: how will I pass Recid of active record in Controller class and then in RDP class.

    Hi Mohit,

    this.parmRecid = contract.parmRecId();

    I am not getting this.parmRecId.

    pls give me more shed on this.

    thanks!

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: how will I pass Recid of active record in Controller class and then in RDP class.

    Hi, You don't need to do anything in main method as you are getting RecId in prePromptModifyContract. Create Coc for processReport method for SalesInvoiceDP class and try adding below code and check if you are getting Recid in DP class.

    public RecId parmRecId; //Global variable
    
    public void processReport()
    {
        this.parmRecid = contract.parmRecId();
        
        next processReport();
    }

  • @rp@n Profile Picture
    @rp@n on at
    RE: how will I pass Recid of active record in Controller class and then in RDP class.

    Hi Girish,

    Contarct class

    [ExtensionOf(classStr(SalesInvoiceContract))]
    final class SalesInvoiceContarct_Extension
    {
        public  IdentifierName  callerName;
        public  RecId           recId;
    
        [DataMemberAttribute('Callerselection')]
        // Use this parm method to get the caller menu item name.
        public IdentifierName parmCallerName(IdentifierName _callerName = callerName)
        {
            callerName = _callerName;
            return callerName;
        }
    
        [DataMemberAttribute('RecId')]
        // Use this parm method to get the recId
        public RecId parmRecId(RecId _recId = recId)
        {
            recId = _RecId;
            return recId;
        }
    }

    Controller class

    protected void prePromptModifyContract()
        {
            SalesInvoiceContract contract   = this.parmReportContract().parmRdpContract();
            contract.parmCallerName(this.parmArgs().parm());
    
            if(this.parmArgs().dataset() == tableNum(CustInvoiceDuplicateTable_W))
            {
                CustInvoiceDuplicateTable_W custInvoiceDuplicateTable = this.parmArgs().record() as CustInvoiceDuplicateTable_W;
                contract.parmRecId(custInvoiceDuplicateTable.RecId);
            }
    
            next prePromptModifyContract();          
         }

    Kindly let me know what to do now in main method in controller class?

    Pls give me more shed on this.

    thanks!

  • @rp@n Profile Picture
    @rp@n on at
    RE: how will I pass Recid of active record in Controller class and then in RDP class.

    Thanks Girish,

    Actually I tried yesterday and got an error in parm method for recid while posted this. Most probably [datamemberattributes('Recid')]

    Kindly send me the code of parmrecid method and in main method what to do.

    Pls give me more shed on this

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,900 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans