3

The current documented way to retrieve the ID of a given community is via the ConnectAPI class.

While this works, the ConnectAPI class has a special requirement: any use of ConnectAPI methods requires (SeeAllData=True) on related test code.

This flies in the face of best practices when it comes to writing test code, and I'd like to avoid it if possible.

Currently, my code's only use of ConnectAPI is ConnectApi.Communities.getCommunities(). Is there a SOQL query or some alternative class I can use and avoid the SeeAllData requirement?

3

[SELECT id, name FROM Network]

from the SObject api, thanks to Lacey Snr and this thread.

| improve this answer | |

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.