In my community I have an iteration that displays "Open" records from a custom object that shows an overview of their record.

Below the overview is a button that currently goes to the standard record detail page and loads a page layout. I would like to hide the record Id from the URL and pass the id behind the scenes.

I have successfully gotten an event to pass when source cmp and destination cmp are on the same page, but these cmp's need to live on separate pages.

How do I pass the event attr to the destination cmp on a separate page?


    <aura:event type="APPLICATION">
        <aura:attribute name="involvementId" type="Id"/>


<lightning:button   onclick="{!c.fireApplicationEvent}" 
     name="{!inv.Id}">Click here.</lightning:button>

source.cmp Controller

fireApplicationEvent : function(cmp, event) {
   var appEvent = $A.get("e.c:InvID");
        "involvementId" : event.getSource().get("v.name") });


<aura:attribute name="messageFromEvent" type="Id"/>

   <aura:handler event="c:InvID" 


destination.cmp Ctlr

handleApplicationEvent : function(cmp, event) {
    var involvementId = event.getParam("involvementId");

    // set the handler attributes based on event data
    cmp.set("v.messageFromEvent", involvementId);

  • To be clear: You're trying to pass the Id to the standard record detail page, which contains the destination component, right? I don't see a way of doing that, but I am curious about why you want to hide the Id. There might be a better way of handling it. Nov 5, 2018 at 1:35
  • I'm trying to pass the Id to a separate custom page with a custom (destination) component on it, instead of using the standard record detail page. I want to hide the ID for confidentiality reasons. Edit: goToComponent is deprecated and not sure how to implement lightning:navigation
    – DCole
    Nov 5, 2018 at 1:48
  • And you're talking about the Salesforce record Id? If your sharing settings for the object are set up correctly, there isn't anything nefarious anyone could (reasonably) do with that. Nov 5, 2018 at 2:00
  • Yes, I know. But how can it be done? I've just gotten sessionStorage.setItem() to work, but disappears on refresh. This is a step forward in what I want, just not user friendly.
    – DCole
    Nov 5, 2018 at 2:03

3 Answers 3


There are sections in the community (usually the template headers and footer) which are consistent across pages (don't reload, and can be used to store attributes) you can use components in those sections to achieve what you are describing.

enter image description here

  • I’m not quite following what you mean.
    – DCole
    Nov 5, 2018 at 2:35
  • "you want to pass the id behind the scenes", store the id in another component which is persistent across community pages, fetch it using an event when your other component in another page loads. in communities, when navigating across pages, not all the the page reloads only the content sections (not template sections)
    – glls
    Nov 5, 2018 at 2:41
  • Let me see if I have this correct. 1. Onclick fire an event that loads the record Id into an attr in a cmp that resides in one of the persistent sections of the community. 2. Forward user to destination page 3. Load attr from cmp in persistent section into content cmp and render page from there. Is that correct? Why is it so difficult to just pass data behind the scenes from one page to another?
    – DCole
    Nov 5, 2018 at 3:46
  • correct - you can also use your browsers sessionstorage variables, (similar to cookies) =P
    – glls
    Nov 5, 2018 at 4:04

Based on your comments, it's clear that you're trying to pass the Salesforce record Id to another custom page without letting the user see the Id. While I'm not sure why showing the Salesforce Id in the URL could have confidentiality implications if your sharing model is set up right, it does sound like you have a need to do so.

Since you're going from custom page to custom page, why not keep the user on the same page, but make it look like a second page. If you put the content for "page 1" and "page 2" in separate divs and show/hide them to make it look like separate pages, then you can avoid passing the Id at all. That's about as secure as it gets!

  • Hi Shane, appreciate all your feedback and help with this. That works if there's a singular record, but some/most of the community visitors will have a "historical" page that will show 20+ records that will need to actually pass the record Id.
    – DCole
    Nov 5, 2018 at 2:18
  • Ah. Well...I like @glls answer better anyway! ;) That's a good call. Nov 5, 2018 at 2:31

You can use the SessionStorage to pass the Id between pages without making it public in the url. Additionally you can encrypt these Id and decrypt them in the component. Session storage only persists until you close the browser

Here you can read more: HTML5 Web Storage

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .