Question

I have a form which is used for automatic journal postings.

On that form I have a Ok command button and in closeOk method of the form I call the method from my datasource table.

In the JournalCheckPost class's infoResult() method I want to determine if the method is called from my form. I know that it can be done with caller methods but I don't know how exactly it should be done technically.

Was it helpful?

Solution

It is bad practice to make a method depend on where it is called from.

What you can do is to pass an extra parameter to the LedgerJournalCheckPost and infoResult can then check that. This can be done by introducing a boolean flag and a parm method.

OTHER TIPS

I think, there can be many situations:

  • You want to pass some parameters from form
  • You want to manipulate the form (for example refresh datasource after action is complete)
  • Something other

But in all the cases depending on particular form is not a very good idea.

In first case you can set parameters from code using parm methods, or, better pass parameters using the Args class

In the second you can cast Args.caller to some interface that contain all the methods you want and manipulate the form using that methods (see \Classes\SysFormRun_doRe usages for example)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top