I try to update the permissions on a field created from the API so that it is visible and usable.

so I do this via the salesforce metadata API.

responses = client.call(:update_metadata, message_tag: :updateMetadata, message: {metadata: { fullName: 'Admin', fieldPermissions: {field: "Contact.custom_attribute1_soap__c", editable: true, readable: true}}, :attributes! => {metadata: {"xsi:type" => "Profile"}}})

client is an instance of the gem Savon.

which gives me this, and seems correct to me !

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://soap.sforce.com/2006/04/metadata" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <tns:metadata xsi:type="Profile">

however, salesforce sends me back a mistake. After hours of searching the documentation I don't understand.

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
         <faultstring>Unable to determine type mapping for type Profile.  Type is illegal here.</faultstring>

One of you could explain my mistake to me, or give me a method to modify the permissions on a custom field created via the API, please?

  • What API call did you make when the "Unable to determine type mapping for type Profile" fault response came back? Feb 21, 2019 at 20:11
  • It's a call to the API soap metadata the URL looks like this: https://um4.salesforce.com/services/Soap/m/39.0/<ID> Feb 25, 2019 at 8:21
  • So you are trying to update the field permissions on the Admin profile via the metadata API, correct? Feb 25, 2019 at 8:26
  • yes, I have created custom fields via the SOAP API and I need them to be visible and editable by the user and by the API. Feb 25, 2019 at 8:54
  • Is there another way to achieve the same result, without using the SOAP API ? Feb 27, 2019 at 9:12

2 Answers 2


One way to update the field permissions via the APIs is with the FieldPermissions that are exposed via the Partner API.

You can update the PermissionsEdit and PermissionsRead fields fairly easily. Use the ParentId to find the PermissionSet.

This is touched on in Metadata API Custom Field Permissions (how to automate this process)


You're missing the attribute "xmlns": "http://soap.sforce.com/2006/04/metadata"


responses = client.call(
    message_tag: :updateMetadata,
    message: {
        metadata: {
            fullName: 'Admin',
            fieldPermissions: {
                field: "Contact.custom_attribute1_soap__c",
                editable: true,
                readable: true
        :attributes! => {
            metadata: {
                "xsi:type" => "Profile",
                "xmlns": "http://soap.sforce.com/2006/04/metadata"

You must log in to answer this question.

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