0

I have searched and could not find a direct answer, most likely because this is new territory for me and I may not be relating the correct items to the information out there.

Using Javascript I am attempting to do some things via the metadata API. Its all well and good with simple elements, however the deleteMetadata call requires a List<String> for thefullNames` parameter.

I have been able to do this successfully but it is Asynchronous:

            '<delete xmlns="http://soap.sforce.com/2006/04/metadata">' +
            '<metadata xsi:type="RemoteSiteSetting">' +
            '<fullName>xxxxxx</fullName>' +
            '<url>https://{!Host}</url>' +
            '</metadata>' +
            '</deleteMetadata>'

I would like to do it via a synchronous process however. The documentation states:

fullNames: Array of full names of the components to delete.

            '<deleteMetadata xmlns="http://soap.sforce.com/2006/04/metadata">' +
            '<metadata xsi:type="RemoteSiteSetting">' +
            '<fullNames>[{"xxxxxx"}]</fullNames>' +
            '<url>https://{!Host}</url>' +
            '</metadata>' +
            '</deleteMetadata>' +

and received the error

Unexpected Element xxxxx during simple type deserialization

I am pretty sure it is because that is not how SOAP types are constructed (I did a json like object).

Ok, So I got it to work for a single value, still not sure how to more than one full name:

            '<deleteMetadata xmlns="http://soap.sforce.com/2006/04/metadata">' +
            '<type>RemoteSiteSetting</type>' +
            '<fullNames>xxxxx</fullNames>' +
            '</deleteMetadata>' +

So the question

What is the proper format for a List element in a SOAP Call to the Salesforce Metadata API from Javascript? Even better if you know where the documentation is located that would be great.

I plan on attempting to add fields, delete fields, update layouts, etc from Javascript and I hope there is some documentation out there......

Or should I just go with: JSForce

1 Answer 1

0

Wow, I was overthinking it:

                '<deleteMetadata xmlns="http://soap.sforce.com/2006/04/metadata">' +
                '<type>RemoteSiteSetting</type>' +
                '<fullNames>xxxxx</fullNames>' +
                '<fullNames>xxxxx</fullNames>' +
                '</deleteMetadata>' +

Simply add an element for each item

You must log in to answer this question.

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