Report defaults different by caller

njhansennjhansen Member Posts: 37
Is there some way to access the call stack in C/AL code?

I've got a report that is called (several layers deep) from a codeunit running in a periodic job started from NAS. I would like its default behavior (date range) to be different if it is running automatically than if a user ran it from a menu.

The closest I can get is to check GUIALLOWED in the report to see whether I'm running from NAS, but there might be times that the same codeunit gets run by a person (for testing), and it would be preferable if the behavior were based on whether the call originated with CU nnnnn, not whether it was actually NAS that started it.

Because of some generic wrapper functions in the call stack, it would be a significant pain to try to filter a record and pass it to the report.run.

Other thoughts:
CU nnnnn sets a Boolean in a setup table somewhere, but that affects everyone system-wide
CU nnnnn creates a dummy file on the client's machine, but that affects all NAV clients running on the machine, and might cause permissions problems

Answers

Sign In or Register to comment.