Modal windows present several alternatives to setup Contexts and Actions for modularity. Consider following examples for a guidance on best practices.
Consider a modal with following characteristics
- This modal can initiate from multiple places in the application
- It achieves a standalone functionality
- Once the action in the modal is performed, application navigates to a fixed page always (regardless of where it was initiated from).
Consider "New Lead" modal in Salesforce application. This can be initiated either from the top header, Leads-Tab drop down menu or from Lead-listing page. When you create a lead, the modal exits and the application always lands in the "Lead Information Page" for further editing.
You may think about following design attributes for Context and Action definition.
- Setup the modal as a separate View in one of the contexts where it is accessible from (e.g. Leads listing page) or alternatively, define it as a separate Context in itself.
- Separate the actions for initiating the modal and the steps in the modal itself. In other words, create two different actions, "Initiate new Lead" which will just invoke the modal from a given page, and "Create New Lead", which actually accomplishes the functionality to create a new lead.
- Share the action "Create New Lead" with all the contexts where such modal can be invoked from. (e.g. Salesforce Home Page). How to share an action?
- "Invoke new Lead" will be an action that is defined individually in each of the originating contexts.
- Set up the destination of "Create New Lead" as "Lead Information Page" as it always lands in that page after the creation of a lead.
Consider a modal window with following characteristics
- Modal that is part of main flow of a primary action in a page
- Supplements other functionality
- Applicable in multiple pages
- After the action in the modal is performed, modal exits and the application lands in the same page where it initiated from. Differentiate this from the first example, where the application lands in a fixed destination page.
Consider "entity search" modal in Salesforce (classic version). This modal is invoked from multiple places during various actions such as creating an opportunity or creating a quote etc. It does not have a standalone functional significance. It supplements one of the core functionalities by allowing comprehensive search to populate a field such as Account Name. When this modal closes, application lands back in the same page where it was initiated from.
- Consider this modal a separate view in one of the existing contexts such as "Lead Info Page". Do not treat this a separate Context.
- Separate the actions for invoking the modal ("Invoke Search Modal") and the action performed in the modal itself ("Search and Select Item").
- Share the "Search" action with all relevant contexts/pages.
- "Invoke Search Modal" will be individually defined by each originating context.
- Setup the destination of "Search" action to "Current context" (not specific name of the page).