This blog is continuation of my previouw blog “CRM 7.0 How to –5B Create an Overview Page with content”
So far I have created a read-only view DetailsOV and assigned it to OverviewPage. Now I want to create a second view for editing purpose. The purpose is to navigate from first view (which is read-only) to this second view which will enable the user to change the data.
Make sure that the new view is same as the first view (fields and their alignment) with the exception that it will be used only for edit purpose.
Follow my Blog CRM 7.0 How to –5A Create a custom component with a simple view to create an empty view called DetailsEF just same as DetailsOV and then assign it to the window.
Once this is done go back to the view details and edit the DetailsEF.htm file and change the code as shown below
After activation double click on the view name, the configuration Tab should appear. As this view will be equivalent to the first view, take into consideration to have same fields in this view as well.
In order to add button to the view DetailsOV add an attribute GT_BUTTON to the *.IMPL.
Redefine the method DO_PREPARE_OUTPUT of the controller.
Go to the DetailsOV.htm file and add the lines shown below.
After this the edit button should appear in the view. Test the application to verify.
Next step is to create the Event Handler to respond this button.
Give the same name you have entered in the method DO_PREPARE_OUTPUT of the controller for parameter on-click. This is case sensitive so to avoid any issues, type it in Caps and system will create the event handler with the prefix EH_ON.
Right click on Outbound plug and create an outbound plug for DetailsOV. Give the name of the target view where the navigation is going to e.g. in this case TODETAILSEF.
Create an inbound plug for the second view DetailsEF. Give the name of the view from where the navigation is coming from e.g. in this case FROMDETAILSOV.
Go to Runtime Repository and switch to edit mode and create navigation from DetailsOV to DetailsEF.
In View DetailsOV go to the event handler and call the outbound plug.
In the outbound plug and call the navigation link just created above.
Since the view DetailsEF is not embedded in an overview page the button needs to be added to the main toolbar. To do that, implement a BACK button on the second view by implementing an Interface for the view controller
Now implement the method GET_BUTTONS
Implement the method GET_NUMBER_OF_VISIBLE__BUTTONS.
Create an event handler for the view DetailsEF make sure that you use the same name used in the GET_BUTTON method.
To enable the navigation back from DetailsEF to DetailsOV create an outbound plug in DetailsEF and inbound plug in DetailsOV.
Create navigation link to enable the back navigation.
Call the outbound plug from the Event Handler EH_ONBACK.
From the outbound plug call the Navigation link.
This concludes the navigation from DetailsOV to DetailsEV and viceversa.
This is what we have achieved so far.
In my next Blog I will cover CRM 7.0 How to –5D Custom Controller and Binding of context nodes