• Ambika Arora 23
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hi, 
Within my lightning component I have a button, and when you press on it, it calls a function within the controller called userUpload. Upon clicking this button, the page will redirect you to the picture upload page. 

How do i get the record id to associate itself with the page? 

Currently I have, 
//Component: 

<aura:component access ="global" implements="force:hasRecordId">
<div>
     Click below to go to upload page
</div>
 <lightning:button label="Upload" onclick="{!c.userUpload}" />


//Controller
    userUpload: function(component, event, helper) {
        var urlRedirect= $A.get("e.force:navigateToURL");
        urlRedirect.setParams({
            "url": "/upload&id=" + component.get("v.record").id
        });
        urlRedirect.fire();
    },
when i console.log(component.get("v.record").id I get undefined. Anyways to fix this?