4

I want to access the Standard "System Administrator" profile using MetadataService.cls (found here https://github.com/financialforcedev/apex-mdapi)

Therefore I tried this

MetadataService.MetadataPort service = new MetadataService.MetadataPort();
service.SessionHeader = new MetadataService.SessionHeader_element();
service.SessionHeader.sessionId = UserInfo.getSessionId();

MetadataService.Profile profile 
 = ( MetadataService.Profile) service.readMetadata(
       'Profile', 
       new String[] { 'System Administrator'}
   ).getRecords()[0];               

Unfortunately profile is not populated by the readMetadata-method. It behaves exactly like a non-existing profile.

How the profile can be read?

8

The issue is the name of the profile.

Using exclipse downloading all profiles, I found that there is an "Admin" profile instead. Reading this the same way as described above, it works.

MetadataService.Profile profile 
 = ( MetadataService.Profile) service.readMetadata(
      'Profile', 
      new String[] { 'Admin' }
   ).getRecords()[0];
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.