NexJ Logo

Portal URL # navigation

The portal server supports the ability to open a given workspace and focus on a given portlet from a hyperlink in email, web page, and so on.  Also, when one navigates to a workspace, the URL changes so the back button is fully supported. 

Hash in URL

The Hash character (also known as the 'fragment indicator') is used to go to "anchors" (for example, https://en.wikipedia.org/wiki/Fender_Stratocaster#Fender_1985-present), it is more recently used to store navigable state in many modern sites -- gmail makes heavy use of it, for instance.

To do this, the usual <serverRoot>/ui/portal URL has a # suffix:

<serverRoot>/ui/portal#<workspaceRef.name>/<portletRef.name>;ctxname1=ctxval1,…,ctxnameN=ctxvalN;argname1=argval1,…,argnameM=argvalM
  • workspaceRef.name is the name attribute of a workspaceRef in the .portal file.

    Partial contents of Contact.portal
    ...   
    <WorkspaceRef name="Home" workspace="mda:Home"/>
    <WorkspaceRef name="Contacts" workspace="mda:Contacts"/>
    <WorkspaceRef name="Schedule" workspace="mda:Schedule"/>
    <WorkspaceRef name="Task" workspace="mda:Task"/>
    <WorkspaceRef name="DocumentManager" workspace="mda:DocumentManager"/>
    <WorkspaceRef name="Opportunity" workspace="mda:Opportunity"/>
    ...
  • portletRef.name refers to the value of the name attribute of a PortletRef in the appropriate .workspace file. The portletRef name is optional. If it is not there, the navigation goes to the workspace. A portlet is required to set context with a context parameter.

    Partial Contacts.workspace file
    <Workspace caption="IDS_CONTACTS" icon="icon:">
       <Navigator name="refEntityNavigator" portlet="mda:EntityNavigator"/>
       <Page case="Person" name="ContactDetail">
          <Banner name="refPersonBanner" portlet="mda:EntityDashboard"/>
          <Tab caption="ids.fins.summary" layout="cols:3 fluid:true" name="tabSummary" type="grid">
             <PortletRef name="refPersonBio" portlet="mda:EntityBio"/>
             <PortletRef name="refPersonActivitiesByEntity" portlet="mda:ChartActivitiesByEntityPieChart"/>
             <PortletRef name="refPersonNotes" portlet="mda:EntityNotes"/>
             <PortletRef name="refPersonActivities" portlet="mda:EntitySummaryActivities"/>
          </Tab>
          <Tab caption="IDS_DETAIL" layout="cols:3 fluid:true" name="tabPersonDetail" type="grid">
             <PortletRef name="refPersonAddresses" portlet="mda:EntityAddresses"/>
             <PortletRef name="refPersonCustomFields" portlet="mda:EntityCustomFields"/>
    ...

In the example above, entering http://localhost:7080/training/ui/portal#Contacts/refPersonBio takes you to the bio portlet on the Contacts workspace.

Alternative ways of finding the WorkspaceRef.name / PortletRef.name:

  1. Look in NexJ Studio in the portal and workspace elements to find the appropriate names.
  2. Use the script recording. For this approach, see Recording and Playback. Enable recording, record a script, click on the portlet you want the names of, stop the script, export the script, and press F12. You should see something like: (sim'use "workspaces/Contacts/p0/tabPersonJournal/refPersonJournalActivities/ref/gridActs#cell.0.2") where Contacts and refPersonJournalActivities are the names you are looking for.

If you don't have Tim Lamont's ID already, you can obtain it by navigating to the following:

http://localhost:7080/training/json/Person?attributes=(firstName lastName)&where=(and (= firstName "Tim") (= lastName "Lamont"))&$indent

Context parameters

<serverRoot>/ui/portal#<workspaceRef.name>/<portletRef.name>;ctxname1=ctxval1,…,ctxnameN=ctxvalN;argname1=argval1,…,argnameM=argvalM

The path entries are followed by any context parameters. These are separated from the path with a semicolon as above, and are a context name and a context value. For example,  EntityId=10D3768FBB32354DD4A413095F2CEB5CC1 as in http://localhost:7080/training/ui/portal#Contacts/refPersonBio;EntityId=10D3768FBB32354DD4A413095F2CEB5CC1

Query string parameters

As an argument, pass “r”, without any value to replace the URL with a random r, so that changes to the URL are detected if identical URLs should otherwise trigger the navigation.

Related links

Invoking specific NexJ CRM workspaces
Recording and playback