In a scratch org, I foolishly removed the "System Administrator" profile from the Members Selected Profiles of a Community and now the "Workspaces" and "Builder" links are no longer available. That means I can't just re-add the "System Administrator" profile. And when I try to push code in (for use by a second Community instance) using SFDX I get this sort of error:

Error force-app/main/default/contentassets/logo.asset We can't install the package because you're not a member of the community Portal. To install it, first add yourself to the community.

Is there any way out of this? I can create a new scratch org, but wonder about this happening in production and so leaving a production Community in a bad state.

  • Have you tried pushing in access for the System Admin within the NetworksMemberGroups in the networks metadata type? Or do you get the same error message? Commented Mar 26, 2020 at 14:01
  • My approach: create a new scratch org :)
    – Phil W
    Commented Mar 26, 2020 at 14:03
  • I've kicked off another scratch org setup...
    – Keith C
    Commented Mar 26, 2020 at 14:05

1 Answer 1


Here's a quick and dirty way to do it:

You can use the Developer Console's Query Editor tab (at the bottom of the window) to run a query on the Network Metadata object to get the Id of the Community/Digital Experience Site you want to add the profile back to:

SELECT Id, Name FROM Network = '<Community Site Name>'

ex: SELECT Id, Name FROM Network = 'Partner Portal'
result ex: 0DB6a0000001234abc, 'Partner Portal'

and then run another query to get the Profile Id of the profile you want:

SELECT id, Name FROM Profile WHERE Name = '<Profile Name>'
ex: SELECT id, Name FROM Profile WHERE Name = 'System Administrator' OR Name = 'Partner Portal User'
result ex: 00e6a0000001234abc, 'System Administrator'
           00e6a0000001765AAC, 'Partner Portal User'

With those two IDs (NetworkID and ProfileID) you will be able to prepare a csv file that will look like this, to add the System Admin profile back as a member of the community (Note that the profile ID is stored in the ParentId field):


Save it as a CSV and insert it with Dataloader into the NetworkMemberGroup metadata table, making sure to map those columns properly.

And flippity jippity, voilà, it's done!

  • Hi Joseph, Makes sense. Presumably you could also insert the NetworkMemberGroup via some execute anonymous Apex too.
    – Keith C
    Commented Sep 11, 2021 at 7:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .