5

I updated some permissions sets in my package and change some field-level security access to read/write false for some objects.

When I run sfdx force:source:pull instead of marking the XML as

<fieldPermissions>
    <editable>false</editable>
    <field>Some_Object__c.Some_Field__c</field>
    <readable>false</readable>
</fieldPermissions>

it removes the reference entirely. So when I push this to a different org the values do not change.

Is there a setting for "preserving" metadata instead of deleting it when read/write access is false?

2
  • I think the command to fetch metadata is 'retrieve' and not pull. Apr 18, 2020 at 23:03
  • @VishalSharma it's pull, you're thinking of the mdapi commands Apr 19, 2020 at 0:26

1 Answer 1

1

At this point there is no such setting. I suggest opening up an enhancement request for this here

When you retrieve permission sets, the docs asks the developer to retrieve the related components with assigned permissions.

The way force:source:pull works is it only retrieves items thats incremented with RevisionCounter in SourceMember object. Currently it only sees permissionset.

For now you can workaround this using the sfdx force:source: retrieve below so you don't have to manually craft the XML. Note that this won't source track, however run sfdx force:source:push to make sure it is tracked.

sfdx force:source:retrieve -m PermissionSet:<permissionsetname1,permissionsetname2>,CustomField:<objectname1>.<fieldname1>,<objectname1>.<fieldname2>

Next time the force:source:pull will not remove those XML elements after you push.

You must log in to answer this question.

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