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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / How to get values from...
Finance forum

How to get values from args caller object.

(0) ShareShare
ReportReport
Posted on by

Hi

I am using this line of code

SalesTable selectedRec = this.args.record() ? args.record() : null;

and then when i debug this I see 1 rec in salestable but no rec for my selectedrec.

What am i doing wrong?

Also please suggest how can i get to assign the value of proforma situated under caller obj to a local variable. Pls ref the pics.

args.PNG

I have the same question (0)
  • Sukrut Parab Profile Picture
    71,741 Moderator on at

    Which class is this ?  Is proforma a global variable ? where you are calling this code ?

  • Mav Profile Picture
    on at

    Its my custom class extending salesinvoicecontroller.

    I am not sure if that is a global variable as it is shown as variable under callerobj

    I am calling this code while running the salesinvoicereport.

  • Sukrut Parab Profile Picture
    71,741 Moderator on at

    well you can go to the base class and see if its a global variable .  You can access  protected global variables using coc . Also I see Salestable   buffer in your screen shot , then what's the point of getting  it from args ?

  • Suggested answer
    Mea_ Profile Picture
    60,286 on at

    You print invoice from a journal and there is global variable custInvoiceJour you can use in the controller class. You can get SalesTable  from it. On your screenshot you have SalesTable  not in args but in callerObject, so if you need it grab it either from custInvoiceJour  or from caller.

  • Mav Profile Picture
    on at

    Sukrut Parab Thanks I am trying to customize the salesinvoice report.

    Mea_

    Looking at controller class I found that I can use CustInvoiceJour.IsProforma() (which will always return true) as an evaluation condition in my code.

    Can you pls provide code sample for how to get the value of salestable rec into my  salestable buffer selectedrec.

    Also where can find current report design being used by the report in debugging window.

    I have extended & customized all designs of report Salesinvoice & Salesinvoice_IN.

    However i still don't  see my customized report when i run the proforma report ,instead i see default report. That is strange considering i have customized all designs for Salesinvoice & slaesinvoice_IN report & restared SSRS service too.

    Any thoughts.

  • Mav Profile Picture
    on at

    Please let me know how to  grab SalesTable value from custInvoiceJour  or from caller

  • Sukrut Parab Profile Picture
    71,741 Moderator on at

    CustInvoiceJour has salesId field, cant you find it from that?

  • Mav Profile Picture
    on at

    @Sukrut thanks , yes we can find it from that. 

    However i was looking to use caller as I can already see the field & its value during debugging , there has to be a way that we could get this using caller. As using caller would save me from making unnecessary calls to sql to get the value which is already there .

    Could you please let me know how can I get this value using caller, can you pls share the code.

  • Mav Profile Picture
    on at

    Hi can anyone please let me know what do I need to do in X++ to get the caller value as shown in pics above.

  • Verified answer
    Martin Dráb Profile Picture
    240,073 Most Valuable Professional on at

    That you can see a value in debugger doesn't automatically mean that it's accessible from your code.

    In your case, the caller object is SalesInvoiceJournalPrint and its salesTable variable is protected, therefore you can't access it from outside. But it's also returned from the public method parmSalesTable(), therefore you can simply call this method.

    SalesInvoiceJournalPrint jourPrint = args.caller() as SalesInvoiceJournalPrint;
    if (jourPrint)
    {
        selectedRec = jourPrint.parmSalesTable();
    }

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans