To simplify tests with community users, I am trying to configure the default community for a specific profile.
Running this in Anonymous Apex, or trying to save my class containing the code:
insert new NetworkAffinity(NetworkId = '0DBJ00000008OXFOA2', ProfileId ='00eJ0000000QeWS');
DML operation Insert not allowed on NetworkAffinity
But the Documentation says:
create(), delete(), describeSObjects(), query(), retrieve(), update(), upsert()
Special Access Rules
To work with the NetworkAffinity object, you must have View Setup or Customize Application permission.
I am a System Admin that has View Setup and Customize Application permissions. Updating an existing record didn't work either.
I never payed attention to these sections cause in general they were accurate. Am I missing something or are they just wrong in this case?