2

I had created custom fields using metadata api,but field is not visible because of FieldLevelSecurity is false,i can make fieldLevelSecurity true using apex for System Admin.thanks in advance

MetadataService.AsyncResult[] asyncResults = service.create(new List<MetadataService.Metadata> {
                        customField
                        });

Like above I am inserting.  

3 Answers 3

2

You can make the field level security by metadata API. When you create the field. Also send the field level permission in Admin Profile type metadata. A sample field permission looks like below.

<?xml version="1.0" encoding="UTF-8"?>
<Profile xmlns="http://soap.sforce.com/2006/04/metadata">
  <fieldPermissions>
        <editable>true</editable>
        <field>ObjectName__c.Field__c</field>
        <readable>true</readable>
    </fieldPermissions>
</Profile>
0

From the Salesforce: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_profile.htm ProfileFieldLevelSecurity represents the field level security for users assigned to a profile. In API version 30.0 and later, permissions for required fields can’t be retrieved or deployed.

1
  • I just found this tool that it is really cool and useful. read the article or search for"Easing the Burden of Bulk Field Level Security Updates in Salesforce" nathanfranklin.com.au/salesforce/…
    – msantana
    Commented Sep 14, 2017 at 18:46
0

As of API version 38.0, you can change field permissions to make a field editable using the Metadata API for fields that you can't change through the user interface. For example, you can deploy Asset.ProductCode as an editable field even though you can't through the user interface. https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_profile.htm

You must log in to answer this question.

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