0

I have a few new custom objects in my unmanaged package and i want to give permissions to existing profiles in the target org. How can i do that? What i tried is the following xml file in my package:

<?xml version="1.0" encoding="UTF-8"?>
<Profile xmlns="http://soap.sforce.com/2006/04/metadata">
    <objectPermissions>
        <allowEdit>true</allowEdit>
        <object>Object1__c</object>
    </objectPermissions>
    <objectPermissions>
        <allowEdit>true</allowEdit>
        <object>Object2__c</object>
    </objectPermissions>
    <objectPermissions>
        <allowEdit>true</allowEdit>
        <object>Object3__c</object>
    </objectPermissions>
</Profile>

There is a profile in the target system called System Administrator so i named the file SystemAdministrator.profile.xml-meta.xml. Im getting this error when installing the package:

Encountered errors installing the package!,Installation errors: 
1) Error parsing file: Element {http://soap.sforce.com/2006/04/metadata}objectPermissions invalid at this location in type EmailServicesFunction, Details: SystemAdministrator.profile: Error parsing file: Element {http://soap.sforce.com/2006/04/metadata}objectPermissions invalid at this location in type EmailServicesFunction

Now im not sure if i did everything correct and its a different problem, or the file above is not working.

3
  • if it is a standard profile -- then it should be called Admin.profile
    – kurunve
    Commented Jan 18, 2021 at 16:07
  • @kurunve What if its a custom profile? And how should the file exactly be called? Like just Admin.profile or Admin.profile.xml-meta.xml
    – Zero
    Commented Jan 18, 2021 at 16:51
  • sorry, I did not see a sfdx tag. in sfdx project, it should a profile full name name ([select id, name, fullName from Profile where name = 'System Administrator']) and it should be .profile-meta.xml
    – kurunve
    Commented Jan 18, 2021 at 17:03

0

You must log in to answer this question.