Why Aggregated XML Shows Double Forward Slashes (<//bsvc:ID>) in Output Files
When building a Workday SOAP payload inside a Loop (for example, generating <bsvc:Enter_Time_Off_Data> fragments in a Create Text Template and combining them with a Loop Aggregation), developers often attach a Log to File step to inspect the aggregated XML on the integration event. Opening the resulting log file reveals doubled forward slashes (<//) in every XML namespace URI and closing tag:
<bsvc:Import_Time_Off_Request_Event_Batch_Request xmlns:bsvc="urn:com.workday//bsvc">
<bsvc:Enter_Time_Off_Data>
<bsvc:Worker_Reference>
<bsvc:ID bsvc:type="Employee_ID">123456<//bsvc:ID>
<//bsvc:Worker_Reference>
<//bsvc:Enter_Time_Off_Data>
<//bsvc:Import_Time_Off_Request_Event_Batch_Request>Root Cause: Log to File Default CSV Escape Character Is /
The Loop Aggregation did not corrupt your XML. As documented in Reference: Log to File, the Log to File component always formats its output as a CSV document using three default special characters when no custom CSV format is selected:
- Separator:
, - Escape character:
/ - Quote character:
"
Because the default CSV escape character in Log to File is /, the CSV serializer escapes every literal / character inside the logged XML string by doubling it to //!
Why .toString().replace("//", "/") Does Not Fix It (and Risks Memory Failures)
Adding a Create Values step before Log to File that calls xmlData.toString().replace("//", "/").asXML() does not remove the <// in the output file, because the single / characters are still re-escaped to // at the moment Log to File writes the CSV row. Worse, converting a large aggregated Xml stream into an in-memory String via .toString().replace(...) bypasses Orchestrate’s streaming XML handler and can exceed string memory limits on large batches.
Two Clean Fixes for Inspecting or Storing Aggregated XML
- Use
Store DocumentInstead ofLog to Filefor XML Payloads (Recommended): Replace Log to File with a Store Document component. Set Document to Store to your aggregated XML output (data.LoopTransactions.AggregatedXml) and Document Title to"BatchPayload.xml". Store Document writes the rawXmlstream directly to the integration event without CSV escaping. - Override the Escape Character in a Custom CSV Format (If Logging XML Inside a CSV Column):
If you intentionally want to embed an XML snippet inside a multi-column Log to File CSV audit table, go to Orchestration Settings > CSV Formats, create a custom CSV format with the Escape character changed from
/to\, and select that Format on your Log to File step.
Also ensure each upstream Create Text Template that produces an XML fragment has its Content Type set to application/xml or text/xml; when the template output is already typed as XML, you do not need to append .asXML() repeatedly.
Writing #if Conditions Without Parentheses in CreateTextTemplate
When conditionally including XML elements inside a Create Text Template (CreateTextTemplate), wrapping the boolean expression after #if in round parentheses ( ... ) or adding nested curly braces causes a template compilation error:
{{!-- INVALID — outer parentheses around the #if condition fail to compile --}}
{{#if (data.cvGovIDvalues.workerHasNoTFN == false)}}
<bsvc:Tax_File_Number>{{data.cvGovIDvalues.tfn}}</bsvc:Tax_File_Number>
{{/if}}Valid #if Syntax in CreateTextTemplate
As specified in Concept: Text Templates, CreateTextTemplate requires the syntax {{#if boolean_expression}} ... {{/if}} without outer parentheses around the condition:
1. Checking a Boolean Variable (true vs. false)
To render an XML block when a boolean variable is true:
{{#if data.cvGovIDvalues.workerHasNoTFN}}
<bsvc:Tax_File_Number>{{data.cvGovIDvalues.tfn}}</bsvc:Tax_File_Number>
{{/if}}To render the XML block only when the boolean variable is false, either negate it with ! or compare directly against false without parentheses:
{{#if data.cvGovIDvalues.workerHasNoTFN == false}}
<bsvc:Tax_File_Number>{{data.cvGovIDvalues.tfn}}</bsvc:Tax_File_Number>
{{/if}}2. Compound && and || Conditions on Strings in XML Templates
You can combine .isEmpty checks and string inequality comparisons using && or || directly inside {{#if ...}} without parentheses:
{{#if data.SupplierValues.AddressLine2.isEmpty == false && data.SupplierValues.AddressLine2 != "NA"}}
<wd:Address_Line_Data wd:Type="ADDRESS_LINE_2">{{data.SupplierValues.AddressLine2.escapeXml()}}</wd:Address_Line_Data>
{{/if}}Verifying XML Output and Conditional Tags in Your Tenant
- In Orchestration Builder, validate your Create Text Template step with conditional
{{#if ...}}blocks and run DebugOrchestrations with bothtrueandfalsetest inputs to verify that optional XML tags are omitted cleanly when the condition is false. - Attach a Store Document step (or inspect the aggregated XML directly in the debugger step output panel rather than a default Log to File CSV) and confirm all closing XML tags render with a single slash (
</bsvc:ID>).