Skip to main content

I'm facing a problem while attempting to retrieve the networkId in my test class for a functionality that involves fetching a user's photo in a community context. In my method, I'm using Network.getNetworkId() to obtain the networkId, and then utilizing it to fetch the user's photo via ConnectApi.UserProfiles.getPhoto(networkId, userId). However, during the test class execution, the networkId is returning as null.

Despite referencing a StackExchange post for insights and ensuring the necessary permissions, the networkId is still coming up as null in the test class.

Could someone can provide insights on why the networkId might be returning null in the test class despite functioning correctly within the method? I'd greatly appreciate any suggestions or guidance on resolving this issue. Thank you!

 

#Apex  #Community  #Community Cloud  #Test Classes

1 answer
0/9000