I have a requirement to provide a link to an external system, which will link to an Account in Salesforce. The external system doesn't store the AccountId, but uses an externalId (UUID). The UUID__c field exists (and is unique) on Account I'll be linking to.

So obviously, if the Account Id was held in the external system, we could just construct a link like this:


Then after authentication, the user would just be taken to the relevant account page in Lightning.

HOWEVER. As previously mentioned, our external system doesn't store the AccountId. The account identifier it does store is called UUID, which is also in Salesforce, on the Account.UUID__c field, which is a unique external ID field.

To solve this in classic, I would create a visualforce page, and get the external system to construct the following link:


Then I'd get the controller for the visualforce page to extract the externalSystemUUID parameter, and query the account using the UUID:

account acc = [select id from account where UUID__c =:externalSystemUUID]

Then I'd get the visualforce page to automatically redirect to the native lightning page.

However, the requirement is to do this in Lightning and I'm not entirely sure what best practice is around this - should I be using a Lightning Component or can I still use a Visualforce page?

Any guidance gratefully received.

  • 1
    Just trying to understand - why would you need a VF page or LC here? As long as your External System has the URL for the record, they can directly navigate to it with authentication. What's your exact requirement here?
    – Jayant Das
    Commented Oct 5, 2018 at 15:47
  • So, the problem is that the external system doesn't hold the actual record id of the account they want to link to - only a unique external id that's also held in Salesforce. I'll edit my original question to clarify. Commented Oct 8, 2018 at 8:56

2 Answers 2


In lightning you can use "lightning:isUrlAddressable" interface with "force:navigateToURL" to redirect to account page on init with 3 steps.

  1. You pass uuid in url
  2. You query and find account id on init
  3. Navigate to account

Link format will be like: https://yourdomain.lightning.force.com/lightning/cmp/c__GetAccountFromUUID?uuid=UUID_HERE


<aura:component implements="flexipage:availableForAllPageTypes,lightning:isUrlAddressable" controller="GetAccountFromUUIDController">
   <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>


    doInit: function(component, event, helper) {
        var uuid = component.get("v.pageReference").state.uuid;
        var action = component.get("c.getAccountId");
            "uuid": uuid
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var accId = response.getReturnValue();
                var urlEvent = $A.get("e.force:navigateToURL");
                    "url": "/lightning/r/Account/"+accId+"/view"
            else if (state = "ERROR")
                alert("no account found");

Apex Controller:

public class GetAccountFromUUIDController {
    public static String getAccountId(String uuid){
        return String.valueOf([select id from account where uuid__c=:uuid].Id);

You can find "lightning:isUrlAddressable" doc here: https://developer.salesforce.com/docs/component-library/bundle/lightning:isUrlAddressable


Did you try considering formula field solution. This way you can reduce lot of effort.

  • A formula field would work fine if I was linking from Salesforce TO the external system, but in this instance it's the other way around. A formula field will not cut it for this requirement. Commented Oct 8, 2018 at 9:15

You must log in to answer this question.

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