1

I need to get Start URL value or ACS URL value of Connected App in Salesforce via Javascript or Apex Class, any idea how to do that?

Regards, Gari

2 Answers2

1

You can query for it in SOQL:

public with sharing class PageController {
    public PageReference getStartUrl() {
        AppMenuItem app = [
            SELECT StartUrl
            FROM AppMenuItem
            WHERE Name = 'app_name'
        ];

        return new PageReference(app.StartUrl);
    }
}

then surface on your page in a script tag etc:

<apex:page controller="PageController">
    <script>
        var startUrl = '{!JSENCODE(StartUrl)}';
    </script>
</page>
Matt and Neil
  • 32,894
  • 7
  • 105
  • 186
0

For 2020 -- read this article - https://help.salesforce.com/articleView?id=remoteaccess_auth_configuration_endpoint.htm&type=5

It does not seem that you can query the SalesforceLoginURL or OAuthToken URL / ACS URL through SOQL (tooling api or not). The SOQL query provided in the other answer against AppMenuItem returned null for my SSO connected apps. Maybe it worked in 2014.

Zerkz
  • 127
  • 6