Unable to use createMetdata() calls to insert Criteria-based Sharing Rules; "Required field is missing: Parent"
Last updated 2017-04-14 ·Reference W-2242063 ·Reported By 5 users
No Fix
Summary
- Criteria-based sharing rules cannot be created via the createMetadata() metadata API call.
Repro
- Executing this SOAP call:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<ns1:SessionHeader soapenv:mustUnderstand="0" xmlns:ns1="http://soap.sforce.com/2006/04/metadata">
<ns1:sessionId> ***** </ns1:sessionId>
</ns1:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<createMetadata xmlns="http://soap.sforce.com/2006/04/metadata">
<metadata xsi:type="ns2:LeadCriteriaBasedSharingRule" xmlns:ns2="http://soap.sforce.com/2006/04/metadata">
<fullName>LeadSharingTest</fullName>
<sharedTo>
<allInternalUsers></allInternalUsers>
</sharedTo>
<criteriaItems>
<field>DoNotCall</field>
<operation>equals</operation>
<value>False</value>
</criteriaItems>
<leadAccessLevel>Read</leadAccessLevel>
<name>LeadSharingTest</name>
</metadata>
</createMetadata>
</soapenv:Body>
</soapenv:Envelope>
- Returns:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata">
<soapenv:Body>
<createMetadataResponse>
<result>
<errors>
<message>Required field is missing: Parent</message>
<statusCode>FIELD_INTEGRITY_EXCEPTION</statusCode>
</errors>
<fullName>LeadSharingTest</fullName>
<success>false</success>
</result>
</createMetadataResponse>
</soapenv:Body>
</soapenv:Envelope>
Workaround
- Create sharing rules via declarative app builder or via Force.com migration tool or IDE
Reported By (5)
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.