I have found it extremely useful to use the switching in the VLF to “jump” from one part of the application to another.
Unfortunately, the documentation is not entirely clear on these matters…
It works simply by calling avSwitch on the framework manager:
#avFrameworkManager.avSwitch To(BUSINESSOBJECT) Named(BUDGET) Caller(#COM_OWNER) Execute(E6AA038E80AE4EE380BC1B36E753277B)
To() is either to BUSINESSOBJECT, APPLICATION or FRAMEWORK. I have only used it to switch to business objects.
Named() is the name of the business object (application or framework).
I have no idea why I need to use Caller(), nor what options I have here.
Execute() is the name of the command I want executed in the business objects. It is the name from the command definition, not from the business object command name.
I have also found it useful to pass a value through the manager, using the avSaveValue method. In the command handler signalling the switch I have written
Invoke Method(#avFrameworkManager.avSaveValue) Instance(1) Withid1(WFANE) Fromavalue(#FPLVALG) #avFrameworkManager.avSwitch To(BUSINESSOBJECT) Named(BUDGET) Caller(#COM_OWNER) Execute(E6AA038E80AE4EE380BC1B36E753277B)
and in the command handler that is then executed I read (and immediately clear) the saved value
Invoke Method(#avFrameworkManager.avRestoreValue) Instance(1) Withid1(WFANE) Toavalue(#FANE) Invoke Method(#avFrameworkManager.avSaveValue) Instance(1) Withid1(WFANE) Fromavalue('')
It is funny how the Instance, Withid1, Withid2 and Withid3 can be used to store a value in four dimensions. When I was first introduced to the Save/Restore methods I was told that Instance and Withid1 both had to be unique, but the idea is clearly to think of the instance value to enumerate a set of values while Withid1-3 are a, possibly multidimensional, key for saving and restoring the values.