I need to create a link to an Opportunity. I get the Opportunity ID from the (REST) API.

I see regular links are


But not sure if the user is using lightning or classic.

How to create a link that does not change between lightining or classic?

  • Have you tried https://na85.lightning.force.com/xxxxxxxxxxxx ?
    – Robs
    Jan 16, 2019 at 20:32

1 Answer 1


A link that will work in any environment is

https://<base domain name>/<Salesforce id>

You can use as your base domain name either your *.lightning.force.com or your Classic domain name (mycompany.my.salesforce.com or na85.salesforce.com).

Salesforce will redirect the user to the appropriate URL for their logged-in experience. Users who are on the Lightning experience will see their browsers redirect through a URL including /_classic/ and then end up at the /r/sObjectName/sObjectId/view URL.

  • 1
    +1 https://login.salesforce.com/<id> or https://test.salesforce.com/<id> also automatically redirects them if already logged in to the appropriate location. If they have multiple saved logins, they can choose which one to use.
    – sfdcfox
    Jan 16, 2019 at 20:39
  • Is there any documentation for this?
    – B Seven
    Jan 17, 2019 at 0:39
  • @BSeven According to this Developer Blog post, Salesforce does not consider URLs to be part of an API and they are not officially supported/documented.
    – David Reed
    Jan 17, 2019 at 0:46

You must log in to answer this question.

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