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:
https://eu1.lightning.force.com/lightning/r/Account/<AccountId>/view
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:
https://eu1.salesforce.com/apex/myPage?uuid=<externalSystemUUID>
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.