0

I am trying to retrieve Settings Metadata using Metadata API. The request body is as follows:-

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<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>{token}</tns:sessionId>
    </tns:SessionHeader>
</soapenv:Header>
<soapenv:Body>
    <tns:retrieve>
        <retrieveRequest>
            <unpackaged>
                <types>
                    <members>TrialOrg</members>
                    <name>Settings</name>
                </types>
                <types>
                    <members>RecordPage</members>
                    <name>Settings</name>
                </types>
                <version>54.0</version>
            </unpackaged>
        </retrieveRequest>
    </tns:retrieve>
</soapenv:Body>
</soapenv:Envelope>

The output is showing me error enter image description here

But when I am trying to retrieve these same settings through workbench, I am able to successfully do it. Here is my package.xml

Package.xml

Here is output from the workbench

enter image description here

Any lead, what I am doing wrong in the SOAP call. anything would be highly appreciable

1
  • Security related note: Try to mask the secrets like session id when posting an example otherwise it might be taken advantage of by some bad actors.
    – metasync
    Commented Mar 4, 2022 at 6:42

1 Answer 1

0

You are missing apiVersion field in the soap request. I believe that field auto-populated by workbench. If you don't specify, sfdc will assume it as first supported version (in my case it was 12). You can check this by viewing the package.xml returned in the retrieve response.

3
  • Whatever listmetadata is showing in the response.. I am trying to retrieve those settings only.. Commented Mar 4, 2022 at 7:03
  • +1 <result> <createdById>0055f000002stKHAAY</createdById> <createdByName>Peter Parker</createdByName> <createdDate>1970-01-01T00:00:00.000Z</createdDate> <fileName>settings/DevHub.settings</fileName> <fullName>DevHub</fullName> <lastModifiedById>0055f000002stKHAAY</lastModifiedById> <lastModifiedDate>1970-01-01T00:00:00.000Z</lastModifiedDate> <type>Settings</type> </result> @metasync Commented Mar 4, 2022 at 7:08
  • Thanks, Buddy..! This is working Commented Mar 4, 2022 at 10:21

You must log in to answer this question.

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