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.



The 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.

|improve this answer|||||
  • I tried to query the UrlPathPrefix field from the Network object but I see that it is empty. @crmprogdev Do you have a suggestion? – nirp Nov 1 '15 at 14:49
  • You might want to query the 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. – crmprogdev Nov 1 '15 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.