Is there a way other than using mdapi wrapper (ServiceController) to e.g. retrieve, update and deploy back some particular (let's say PermissionSets or Profiles) entities inside the one given org. We don't need some ideal
or one-for-all
class like that one
-
Are you trying to update Metadata from Apex? Are you using the MDAPI Apex wrapper from GitHub?– cropredyCommented May 27 at 17:43
-
My question was how to perform it without wrapper– pincetCommented May 28 at 5:53
1 Answer
As long as your org is configured to allow this, you can access the metadata API directly. For example, you can use the readMetadata and updateMetadata calls directly, which are synchronous calls. Also, some types of profile metadata are directly accessible inside Apex, for example, SetupEntityAccess allows you to add or remove classes, pages, etc to a profile or permission set. You can also use ObjectPermissions
and FieldPermissions
to add/remove/modify permissions for a particular field for a particular profile or permission set, PermissionSetAssignment
for assignments, and PermissionSetGroupComponent
to work with Permission Set Groups.
-
sfdcfox - i'm a little bit confused. What does
metadataConnection
mean in Metadata API Developer Guide?– pincetCommented May 28 at 6:01 -
1@pincet It's generated code from an imported WSDL. Same as it would be in Java, PHP, etc.– sfdcfox ♦Commented May 28 at 8:37
-
@sfdxfox - still confused. Could you please update your answer within the exapmle regarding connection? Should we use named creds or sessionId?– pincetCommented May 28 at 8:58