Hot answers tagged

15 votes
Accepted

Property 'tab' not valid in version 42.0

Noting this here for reference in case others run into the issue - the "tab" XML attribute has been renamed to "tabs" in Spring '18. So just change the tag name and you're good to go: <?xml ...
user avatar
  • 691
7 votes
Accepted

For a new class should i upload meta.xml to github?

meta.xml files for code carries two important attributes 1)An attribute for mentioning version 2)Status of your class Ideally it is better to checkout both to SVN so that in case one of your dev ...
user avatar
6 votes
Accepted

How to use BuildRowSetFromXML with an "attribute-id" in SFMC?

The online documentation for the BuildRowSetFromXML function isn't very clear on how to reference attribute values, but if you pay attention to the table at the bottom of the page, you'll notice that ...
user avatar
  • 1,457
5 votes
Accepted

Deploying Business processes with ANT

There are two ways: The entire object According to the documentation business processes are deployed as part of the custom object metadata file (.object), so you get it if you include the object in ...
user avatar
  • 28.7k
5 votes
Accepted

How to Use an XML Static Resource to Program Unit Tests?

You can query the static resource object during test methods and then get the body of the document and assign it to a string. sr = [Select Body From StaticResource Where Name = '{DOCUMENT NAME}' ...
user avatar
  • 53.1k
5 votes
Accepted

Suggestions for Unit Tests on an APEX Class that Calls a Web Service and Retrieves XML

Your logic should be tested completely... for webservice calls there are mock callouts you can make to test out your logic. Salesforce HttpCalloutMock Doc Pretty much your mock method will have your ...
user avatar
  • 2,113
5 votes
Accepted

What is the proper way to build an XML text node from a string that contains unsafe entities?

In element text the only requirement is to escape < and &, so i beleive the behaviour you're seeing is correct. The Character data section of the XML Spec says "The ampersand character (&...
user avatar
  • 7,830
5 votes
Accepted

XML parsing in Apex

You can use the Document and XmlNode classes in the DOM namespace to parse XML. String xml = '<?xml version="1.0" encoding="utf-8"?><response><task id="56639c84-7f73-4ace-b7ab-...
user avatar
  • 143k
5 votes

Method does not exist or incorrect signature: void format(String) from the type Date

Date does not have a format() method accepting a string. That method is available only on DateTime. You can create a DateTime from a Date and simply use a format string that does not include time-...
user avatar
  • 87k
5 votes
Accepted

How to control the property name of a serialised object using Apex

If you want to use reserved keywords as keys in your JSON payload, the simplest solution is to just use Map<String, Object> rather than a concrete type. system.debug(JSON.serialize(new Map<...
user avatar
  • 143k
5 votes
Accepted

make LWC's targetConfig's property mandatory

Unless I'm missing something with your question, why can't you just add the required attribute to your property? e.g. <targetConfigs> <targetConfig targets="lightning__RecordPage"&...
user avatar
  • 5,489
4 votes
Accepted

Error: XML Tree depth greater than 50

Is that the exact wording of the error? If so, congratulations! You appear to be the first person ever to run into that limitation. And it's almost certainly an undocumented Salesforce limit. I also ...
user avatar
  • 11.1k
4 votes
Accepted

Verify getChildElement() is not null

The previous answer I gave you assumed success, but for robustness, you can certainly iterate through all expected values. For example: Dom.Document doc = new Dom.Document(); doc.load(res.getBody()); ...
user avatar
  • 434k
4 votes

XML to String indentation

There doesn't appear to be any way to do this on the platform out of the box, I think you'd have to build up the string yourself taking care of the indentation in code which would frankly be messy and ...
user avatar
  • 24.7k
4 votes

What XML support salesforce provides in apex

Answer for both questions is NO. At least directly. Salesforce currently doesn't support direct serialisation of objects into XML format. You can only parse or create XML using XMLDom and ...
user avatar
  • 22.2k
4 votes
Accepted

Error parsing xml with special character

It's not "XML with a special character". It's non-XML. The error message suggests you have an ampersand followed by some character that can't legally follow an ampersand, e.g. '#' or a name-start ...
user avatar
4 votes
Accepted

Best Practices for generating large XML files

I frequently work with integrations that use JSON as well as integrations that use XML. I much prefer JSON because of the native serialization/deserialization that is offered by APEX, but I have ...
user avatar
  • 3,952
4 votes
Accepted

partial formatting in excel cell using xml spreadsheet in salesforce

An excel cell row which have partial worlds in bold should look like this: <Cell> <Data ss:Type="String"> <Font html:Color="#000000" xmlns="http://www.w3.org/TR/REC-...
user avatar
  • 22.2k
4 votes

List<string> how much values/Size can it store?

A list can store many thousands of items and the total space used by the items and list can be several megabytes. But to convert a list into a string that represents all the items in the list, you ...
user avatar
  • 130k
4 votes
Accepted

How to download a file created by APEX

You would need to set up a download action. Arguably, this is probably most easily done with a download link: <!-- visualforce --> <a href="data:application/vnd.adobe.xdp+xml;base64,{!...
user avatar
  • 434k
4 votes
Accepted

Pass null to webservice number field?

You should be able to specify null with xsl:nil: <ns0:Number_Field__c xsl:nil="true" />
user avatar
  • 434k
4 votes
Accepted

How to assign a right curly bracket } as attribute value inside the markup of a lightning component?

You can replace } with unicode \u007D and it is working. I just tried. <lightning:button label="{! 'label {1' + '\u007D' }" /> Gives the output:
user avatar
  • 8,362
4 votes
Accepted

System.XmlException: start tag unexpected character =

There are few things wrong with the xml. 1) In Apex, the string starts and end with single quotes ' , thus you don't need to escape " 2) You cannot use & in XML, it makes XML invalid, you have ...
user avatar
4 votes
Accepted

Using AMPscript to pull XML from DE

I'd recommend looking over how XPATH 1.0 works -- that's the key part to understanding how to pull node attributes and values from the payload. Here's an example with a different, but similar ...
user avatar
  • 28.1k
4 votes
Accepted

How to validate LWC's XML properties?

You can't actually stop the user entering bad data (they could even enter values that are not currency names - you might want to think about using a picklist data source, or even have some apex to ...
user avatar
  • 27.5k
3 votes

Suggestions for Unit Tests on an APEX Class that Calls a Web Service and Retrieves XML

In addition to Double A's response, I find it useful to place mock responses within StaticResources and then have my mock class read the StaticResource and return the XML (or JSON) payload into a ...
user avatar
  • 62.4k
3 votes
Accepted

Not able to update Rich text field with XML data

RichTextArea strips out certain tags from the markup and so this is why your data isn't stored correctly. Test__c cr = new Test__c(id='a0H11000008jpJD'); cr.xml__c = '<?xml version="1.0" encoding="...
user avatar
3 votes

How to convert an Dom.XMLNode to its String representation in order to get CDATA content

I was able to work around this issue using EncodingUtil. Before converting the HttpResponse to a Dom.XMLNode, I removed the CDATA encapsulation using String methods. String xml = Http.send(request)....
user avatar
3 votes
Accepted

Parse XML fails with null object dereference

I see that your XML string contains one single node, Order, and its content is a JSON string, not having children XML nodes, so you can't invoke getChildElement() with a non-existent subnode. Try to ...
user avatar
3 votes
Accepted

how to parse xml from apex- parsing results null

When the XML includes namespaces, you need to supply the namespace as the second argument: String envNs = 'http://schemas.xmlsoap.org/soap/envelope/'; dom.XmlNode Body = xroot.getChildElement('...
user avatar
  • 130k

Only top scored, non community-wiki answers of a minimum length are eligible