Here's my query : I have a data contract class where there is a parameter : AgingPeriodSet
I need to use that parameter in another class namely ReportLines class which is not a DP class.
How would I use the contract class in the ReportLines class, in order to get the value passed in the report parameter for AgingPeriodSet.
I need to use AgingPeriodSet value in a select query to fetch records.
PS: This has to be done in Dynamics 365 for Finance and Operations and all the objects that I have mentioned above are customised objects.
What behaviour are you trying to implement? Do you mean that ReportLines triggers printing of the report and instead of getting values from a report dialog, you want ReportLines to populated them in code?
By the way, please ask questions about development in the Developer forum. I'll move this thread there for you.
Thanks for your reply!
The report is using query as well as contract class for the report dialog. And yes, ReportLines class is triggering the line printing of the report.
For eg., I have the option of selecting multiple Item Id in the report dialog to generate my report. Along with that, there is a field AgingPeriodSet where the user can enter a value.
My requirement is, suppose the user selects "One Year" as the value for AgingPeriodSet field in report dialog, I want to fetch "One Year" into my ReportLines class.
Also note that AgingPeriodSet is a parm method in the contract class of my report. I need to use that parm method in ReportLines class.
Any help is appreciated:)
I don't understand. You trigger report printing. A report dialog is displayed, a user fills in values and you want to use these values for filtering. The normal approach is just taking values from the contract and use them in data provider for the report. You don't have to do anything for it; the framework will pass values from the dialog to the report provider automatically.
Instead, you ask for interrupting the process and returning data from the report dialog back to some class. Why? It's not impossible, but why would you do that?
Yes, it is possible to get the values from the dialog to the provider and that's the conventional approach.
But in my case, I need to pass the dialog values to a different class because the line data of the report isn't getting populated in the data provider class.
Instead line data is populated in an altogether different class. Here, I want to fetch a parameter value from the dialog in order to fetch a table buffer for some other requirement.
To conclude, I want to know if it's possible to pass the report dialog value to a class other than a data provider class? If yes, how do I go about it ?
If you need to call a different class, call it from the data provider.
Your design (at least as I understand it) doesn't make sense in many scenarios. For example: I schedule a report (let's say expected deliveries) to be executed every night and emailed. I close the dialog and according your design, the data should be created at that moment. Then the report would generate data just once and not every time it runs. It would be useless.