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 ...
berry120's user avatar
  • 701
7 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-...
David Reed's user avatar
  • 92.1k
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 ...
Mark G's user avatar
  • 1,545
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 (&...
superfell's user avatar
  • 7,900
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-...
Adrian Larson's user avatar
  • 149k
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<...
Adrian Larson's user avatar
  • 149k
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"&...
Nick C's user avatar
  • 6,456
4 votes

How to copy one XML Dom onto another?

Using the Dom.Document interface, there's no way to append a node arbitrarily as a child to another node. You could write such a function, though, by accepting two nodes in a function, the target and ...
sfdcfox's user avatar
  • 482k
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 ...
dsharrison's user avatar
  • 3,992
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 ...
Michael Kay's user avatar
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-...
Ashwani's user avatar
  • 22.6k
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 ...
Keith C's user avatar
  • 135k
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,{!...
sfdcfox's user avatar
  • 482k
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" />
sfdcfox's user avatar
  • 482k
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:
javanoob's user avatar
  • 8,807
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 ...
Pranay Jaiswal's 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 ...
Adam Spriggs's user avatar
  • 30.2k
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 ...
Phil W's user avatar
  • 34.4k
3 votes

permission, permission sets, XML, objects

You can find the appropriate values in the Profile object. The XML looks like: <Profile ...> <classAccesses> <apexClass>MyClass</apexClass> <enabled>...
sfdcfox's user avatar
  • 482k
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('...
Keith C's user avatar
  • 135k
3 votes
Accepted

getChildElement element failing null pointer exception

Your XML has a default namespace defined via the xmlns attribute so you will have to supply the namespace when referencing the elements: String ns ='http://schemas.microsoft.com/search/local/ws/rest/...
Keith C's user avatar
  • 135k
3 votes

Escape XML Function in VisualForce?

You can use apex:outputText to escape sensitive characters. You can use it like this: <apex:outputText value="{!record.field}" /> There's a parameter called "escape" that defaults to true; in ...
sfdcfox's user avatar
  • 482k
3 votes
Accepted

Escape XML Function in VisualForce?

If you think that <br> tags in your formula fields are the problem, can you try to substitute them either in controller, or in outputText like this: <apex:outputText value="{!SUBSTITUTE(...
smukov's user avatar
  • 5,513
3 votes
Accepted

Method does not exist or incorrect signature: [System.XmlStreamWriter].writeCharacters(Date)

If you look at the XmlStreamWriter documentation, the signature of the writeCharacters method accepts String only. writeCharacters(text) Writes the specified text to the output stream. ...
Adrian Larson's user avatar
  • 149k
3 votes

When can or can't I use Wsdl2Apex?

The web based version of WSDL2Apex is ultimately a code generator for WebServiceCallout.invoke. If you use it then you generally get the limitations for both WSDL2Apex and WebserviceCallout.invoke. ...
Daniel Ballinger's user avatar
3 votes
Accepted

Getting error as required field missing

Problem lies in your code at this line newcontacts.add(c); This is part of your outer loop, and it is going to add Contact for every node, be it ContactNode or Not. So you have build a logic around ...
Mahmood's user avatar
  • 5,934
3 votes
Accepted

Consuming xml flat files in Salesforce

If the volume of data is not huge, then the simplest way to read the data is to use Apex's DOM parser: Dom.Document doc = new Dom.Document(); doc.load(xml); and then the various methods that let you ...
Keith C's user avatar
  • 135k
3 votes
Accepted

XML for creating Metadata with SOAP API

The request body is alright except for the xsi:type="ns0:Metadata" attribute. Instead of the abstract ns0:Metadata, that should read ns0:CustomObject for example: <soap-env:Header> <ns0:...
Matt and Neil's user avatar
3 votes
Accepted

How to generated the below XMlStructure Based on list size?

Try with this Apex provides classes that enable you to work with XML content using the DOM (Document Object Model). Execute below code in anonymous window, List<Product_for_Sample_Literature__c&...
NITHESH K's user avatar
  • 2,515
3 votes
Accepted

NamedCredential soap request authentication headers

In your Named Credential configuration, make sure you specify "Allow Merge Fields in HTTP Body", which will allow you to use the merge fields from your Named Credential. Then, use the $Credential ...
sfdcfox's user avatar
  • 482k

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