1

On Metadata API version 50.0, when I update FieldPermissions on a PermissionSet, the other FieldPermissions on the same PermissionSet are reset.

The updateMetatdata call worked correctly on version 30.0. I'm unsure which version the behavior changed.

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://soap.sforce.com/2006/04/metadata" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="http://soap.sforce.com/2006/04/metadata">
  <env:Header>
    <ins0:SessionHeader>
      <ins0:sessionId>XXX</ins0:sessionId>
    </ins0:SessionHeader>
  </env:Header>
  <env:Body>
    <ins0:updateMetadata>
      <ins0:metadata xsi:type="ins0:PermissionSet">
        <tns:fieldPermissions>
          <tns:field>Receipt__c.Notes__c</tns:field>
          <tns:editable>true</tns:editable> 
          <tns:readable>true</tns:readable></tns:fieldPermissions> 
          <ins0:fullName>JasminePermissionSet</ins0:fullName> 
          <tns:label>JasminePermissionSet</tns:label>
      </ins0:metadata>
    </ins0:updateMetadata>
  </env:Body>
</env:Envelope>

Am I missing something?

1 Answer 1

1

This changed in version 40.0, and was apparently sent out to developers via email. I previously answered this in 2017 when we had a question about it. You must retrieve the contents of a Permission Set and set any new permissions. This change was made to make it easier to manage Permission Sets with respect to Unlocked Packages. If you want the old behavior, use API version 39.0 or lower. This is intended as a stopgap solution while you update your code/logic to anticipate the new behavior.

You must log in to answer this question.

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