Page History
...
- Open the Employees’ Details command handler iiiCOM06.
- Display the Design tab.
- In the Repository tab, locate Weblets, then the ub_pushb1 weblet.
- Drag and drop the ub_pushb1 weblet next to the Save button in the command handler.
- Display the Source tab.
- Add this code before the UHandleEvent webroutine to set the caption of the button to Back:
OverrideOverride Field(#UB_PUSHB1)Default('Back')
WebWeb_MapFor(*both)Fields(#UB_PUSHB1) - In the UHandleEvent register the Back button Click event:
InvokeInvoke Method(#avFrameworkManager.avRegisterEvent) Named(UB_PUSHB1.CLICK) Signalaswamevent(2)
The UHandleEvent will now look like this: - Next scroll to the end of the WAM source and add an event routine to handle the Back button Click event:
Evtroutine Handling(#avFrameworkManager.uWAMEvent_2) Options(*noclearmessages *noclearerrors)
Endroutine - In this routine add this code so that when the users click on the button, they will be switched back to the business object from which they came:
definedefine field(#ff_objnme)TYPE(*CHAR)LENGTH(32)DESC('Object
defineName')define field(#ff_cmdnme)TYPE(*CHAR)LENGTH(32)DESC('Command
#avframeworkmanagerName')#avframeworkmanager.avrestorevalueWithID1(SWITCH_HISTORY)WithID2(OBJECT_NAME)
#avframeworkmanagerToAValue(#ff_objnme)#avframeworkmanager.avrestorevalueWithID1(SWITCH_HISTORY)WithID2(COMMAND_NAME)ToAValue(#ff_cmdnme)#avframeworkmanager.avSwitchTo(BUSINESSOBJECT)NAMED(#ff_objnme)EXECUTE(#ff_cmdnme)Caller(#com_owner)- When you want to send the user back to the component from which the switch occurred, you need to look at the switch history on the virtual clipboard. Remember that you need to retrieve both the business object and the command to which you need to return. That requires retrieving two values from the virtual clipboard.
- The code first retrieves the OBJECT_NAME or business object value and then the COMMAND_NAME or command value.
- When you have these two values you can perform another switch to return to the previous component.
Your code should look like this:
- Compile the command handler and check it in.
You are now ready to test the switch history: - In the Framework select a section from the Department Sections business object.
- Display the details of the section's employees by clicking on the Details button.
- On the Details command handler of the Employees business object click on the Back button to return to the Sections business object.
- Close the application.




