I would like to retrieve custom fields with field level security using package.xml. How to prepare package.xml for this?
Thanks, Anil Kumar
You have to specify the profiles to retrieve the security for, as well as the object/fields. For example:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types><members>*</members><name>CustomField</name></types>
<types><members>*</members><name>Profile</name></types>
<version>44.0</version>
</Package>
This should give you all permissions for all custom fields for all profiles. You can use CustomObject entries as well if you want object-level security settings. Note: CustomObject requires you to manually specify standard objects (e.g. Account, Case) to get those objects, instead of just using the wildcard.