Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

Get current selected parameter in records to include query of vendor account statement

(0) ShareShare
ReportReport
Posted on by 74
Hello everyone,
 
I want to generate and send the vendor account statements to the selected vendor or vendor group specified in the 'Records to Include' parameter. While I understand that obtaining the RecId is possible in 'prePromptModifyContract' if the report is generated from a form, I am not sure about how to achieve the same in a standalone output report in controller class, particularly when dealing with the vendor or vendor group in the 'Records to Include' query . i want to get the parameter from contract class and records to include filter to generate and send the attachment  Please suggest a way i can achieve this
 
Regards,
  • Verified answer
    Finopscello Profile Picture
    Finopscello 74 on at
    Get current selected parameter in records to include query of vendor account statement
    Hello Martin,
     
    Thankyou for the suggestion. I'm able to get the record now by using bellow snippet.
     
    protected void preRunModifyContract()
        {
            super();
    
            VendTable VendTablelcl;
            Query query;
            QueryRun queryRun;
            query = this.getFirstQuery();
            
            queryRun = new QueryRun(query);
            while (queryRun.next())
            {
                VendTablelcl = queryRun.get(tableNum(VendTable)) as VendTable;
            }
            
    
    
        }
     PS: I'm trying to mark Martin answer as verified but site keeps getting stuck on processing.
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,445 Most Valuable Professional on at
    Get current selected parameter in records to include query of vendor account statement
    You can call getFirstQuery() in the controller class.
  • Finopscello Profile Picture
    Finopscello 74 on at
    Get current selected parameter in records to include query of vendor account statement
    Hello Waed,
     
    I know how to get the query in DP. However, my goal is to send vendor account statements as emails to the selected vendors directly specified in the 'Records to Include' query or to the vendors belonging to the vendor group selected in the same query. For the email logic, I have created a separate class where I pass the vendor and contract class. Now, I want to call this class from my controller class extension and iterate through the vendors obtained from the 'Records to Include' query. I am facing difficulty in accessing the 'Records to Include' query in my controller class, I'm not sure how to do that
  • Waed Ayyad Profile Picture
    Waed Ayyad 6,408 Super User 2024 Season 2 on at
    Get current selected parameter in records to include query of vendor account statement
    Hi,
     
    You can call the query in the DP class ( records to include).  On processReport method add the following code :
     
    Query query = this.parmQuery();
     
    QueryRun queryRun = new QueryRun(query);
    while (queryRun.next())
    {
    // assume Vendor table is Table 1 and vend group is Table2
    Table1 = queryRun.get(tableNum(Table1));
    Table2 = queryRun.get(tableNum(Table2));
    // insert in your temp table
    }

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans