Soap 使用Salesforce的元数据api更新fieldPermissions
我尝试更新从API创建的字段的权限,使其可见和可用 所以我通过salesforce元数据API来实现这一点Soap 使用Salesforce的元数据api更新fieldPermissions,soap,salesforce,soapui,savon,sfdc-metadata-api,Soap,Salesforce,Soapui,Savon,Sfdc Metadata Api,我尝试更新从API创建的字段的权限,使其可见和可用 所以我通过salesforce元数据API来实现这一点 responses = client.call(:update_metadata, message_tag: :updateMetadata, message: {metadata: { fullName: 'Admin', fieldPermissions: {field: "Contact.custom_attribute1_soap__c", editable: true, read
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
是gemsavon的一个实例
这给了我这个,对我来说似乎是正确的
<?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">
<env:Header>
<tns:SessionHeader>
<tns:sessionId>s3ss10n1d</tns:sessionId>
</tns:SessionHeader>
</env:Header>
<env:Body>
<tns:updateMetadata>
<tns:metadata xsi:type="Profile">
<tns:fullName>Admin</tns:fullName>
<tns:fieldPermissions>
<tns:field>Contact.custom_attribute1_soap__c</tns:field>
<tns:editable>true</tns:editable>
<tns:readable>true</tns:readable>
</tns:fieldPermissions>
</tns:metadata>
</tns:updateMetadata>
</env:Body>
</env:Envelope>
s3ss10n1d
管理
Contact.custom\u attribute1\u soap\u c
真的
真的
然而,salesforce给我回了一个错误。
经过几个小时的搜索文档,我不明白
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>Unable to determine type mapping for type Profile. Type is illegal here.</faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
soapenv:客户端
无法确定类型配置文件的类型映射。这里的类型是非法的。
你们中的一位可以向我解释我的错误,或者给我一个方法来修改通过API创建的自定义字段的权限,好吗 您缺少属性“xmlns”:http://soap.sforce.com/2006/04/metadata“ 尝试: }
)您缺少属性“xmlns”:http://soap.sforce.com/2006/04/metadata“ 尝试: }
)在我的例子中,以下模式有效:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tns="http://soap.sforce.com/2006/04/metadata">
<soapenv:Header>
<tns:SessionHeader>
<tns:sessionId>your_id</tns:sessionId>
</tns:SessionHeader>
</soapenv:Header>
<soapenv:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tns:updateMetadata>
<tns:metadata xsi:type="tns:Profile">
<tns:fullName>Admin</tns:fullName>
<tns:fieldPermissions>
<tns:field>CustomObject__c.CustomField__c</tns:field>
<tns:editable>true</tns:editable>
<tns:readable>true</tns:readable>
</tns:fieldPermissions>
</tns:metadata>
</tns:updateMetadata>
</soapenv:Body>
</soapenv:Envelope>
你的身份证
管理
CustomObject\uuuu c.CustomField\uuu c
真的
真的
在我的例子中,以下模式有效:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tns="http://soap.sforce.com/2006/04/metadata">
<soapenv:Header>
<tns:SessionHeader>
<tns:sessionId>your_id</tns:sessionId>
</tns:SessionHeader>
</soapenv:Header>
<soapenv:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tns:updateMetadata>
<tns:metadata xsi:type="tns:Profile">
<tns:fullName>Admin</tns:fullName>
<tns:fieldPermissions>
<tns:field>CustomObject__c.CustomField__c</tns:field>
<tns:editable>true</tns:editable>
<tns:readable>true</tns:readable>
</tns:fieldPermissions>
</tns:metadata>
</tns:updateMetadata>
</soapenv:Body>
</soapenv:Envelope>
你的身份证
管理
CustomObject\uuuu c.CustomField\uuu c
真的
真的