I would like to get the getLoginUrl information of a Network sObject.
what is the be way to get this information dynamically via SOQL? since static methods can't be invoked dynamically.
Thanks
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityThe UrlPathPrefix
field (name of the community that's appended to the network path to reach its home page) can be queried from the Network Object. See the Object Reference for more on what can be queried on a Community Network.
If the log-in page has been overridden, you'd also want to query the NetworkPageOverride object. You should be able to combine these into a single query using a subquery to obtain both to obtain any override settings. Querying the latter requires the network's Id and I don't think you'd want to run two queries if you can avoid it.
UrlPathPrefix
field from the Network object but I see that it is empty. @crmprogdev Do you have a suggestion?
Status
field too to see if it's Live, Down for Maint, or Under Construction plus try OptionsShowAllNetworkSettings
(show or hide config data). That being said, from the object ref: "If you have “Modify All Data,” “View All Data,” or “Create and Set Up Communities,” you can view all communities in the organization. Users without these permissions only see the Preview or Published communities that they’re members of." I don't know of anything else that's likely to help you directly replace get('startURL')
if that's what you're looking for.
Nov 1, 2015 at 15:12
For anyone searching yet for a solution:
String networkId = [SELECT Id FROM Network WHERE Name = 'COMMUNITY_NAME']?.Id; // (extra point) using Safe Navigation Operator (?.)
System.debug('Community login url: ' + System.Network.getLoginUrl(networkId));