1

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

I see regular links are

https://na85.lightning.force.com/lightning/r/Opportunity/xxxxxxxxxxx/view

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

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

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

1 Answer 1

5

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.

3
  • 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
    Commented Jan 16, 2019 at 20:39
  • Is there any documentation for this?
    – B Seven
    Commented 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
    Commented 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 .