function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Surender reddy SalukutiSurender reddy Salukuti 

how can i pass record id in url ?

Hi i have a requirement how can i pass record id value in url plese help me on this i have tried with below code but not working 

var recordid= component.get("v.recordId");
        var urlEvent = $A.get("e.force:navigateToURL");
        urlEvent.setParams({
            "url": "https://farmersagent--intdev.lightning.force.com/lightning/r/Account/0011b00000xc84cAAA/related/Quotes__r/view?0.source=alohaHeader"
        });
        urlEvent.fire();
       
    },
if i hardcode id it working fine 
in place of 0011b00000xc84cAAA this id replace with recordid it's not working can any one help me on this 

Thanks ,

Surender Reddy 

Suraj Tripathi 47Suraj Tripathi 47
Hi Surender,

Try below code it should work if not then check your recordId data.
 
var urlEvent = $A.get("e.force:navigateToURL");
        urlEvent.setParams({
            "url": "https://farmersagent--intdev.lightning.force.com/lightning/r/Account/"+component.get("v.recordId")+"/related/Quotes__r/view?0.source=alohaHeader"
        });
        urlEvent.fire();
       
    },

If you find your Solution then mark this as the best answer. 

Thank you!
Regards 
Suraj Tripathi

 
AbhinavAbhinav (Salesforce Developers) 
As sugeested in below sample code for address:
 
navigate : function(component, event, helper) { //Find the text value of the component with aura:id set to "address" var address = component.find("address").get("v.value"); var urlEvent = $A.get("e.force:navigateToURL"); urlEvent.setParams({ "url": 'https://www.google.com/maps/place/' + address }); urlEvent.fire(); }

I think you can concat that for record Id as well.

https://developer.salesforce.com/docs/component-library/bundle/force:navigateToURL/documentation

​​​​​​​Thanks!