Created
May 16, 2020 04:59
-
-
Save lukethacoder/135d94c5dd83ca84241ef076a7e31c32 to your computer and use it in GitHub Desktop.
APEX snippet to give the current user access to the community (will bring back the `Workspaces | Builder` buttons)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String endpoint = URL.getSalesforceBaseUrl().toExternalForm()+'/services/data/v47.0/sobjects/NetworkMemberGroup'; | |
HttpRequest httpRequest = new HttpRequest(); | |
httpRequest.setEndpoint(endpoint); | |
httpRequest.setMethod('POST'); | |
httpRequest.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID()); | |
httpRequest.setHeader('Content-Type', 'application/json;charset=UTF-8'); | |
// Change network id and profile/permission set Id | |
httpRequest.setBody('{"NetworkId":"0DBB00000004d57","ParentId":"00eB0000000fegYIAQ"}'); | |
Http http = new Http(); | |
HttpResponse httpResponse = http.send(httpRequest); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
may need to adjust the API version in the endpoint URL