Skip to content
KiweelyKiweelyKiweely

Why Log to File Turns XML Closing Tags into <// and How to Write #if Conditions in CreateTextTemplate

Viewing aggregated XML through a Log to File step in Workday Orchestrate turns every closing tag ‘</’ into ‘<//’ because Log to File defaults its CSV escape character to ‘/’. Use Store Document for XML files, and omit outer parentheses around #if conditions in CreateTextTemplate.

  • Checked against Workday on
  • Applies to Workday Orchestrate
  • 3 min read
  • Published
  • By Kiweely
On this page

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:

xml
<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

  1. Use Store Document Instead of Log to File for 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 raw Xml stream directly to the integration event without CSV escaping.
  2. 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:

handlebars
{{!-- 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:

handlebars
{{#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:

handlebars
{{#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:

handlebars
{{#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

  1. In Orchestration Builder, validate your Create Text Template step with conditional {{#if ...}} blocks and run DebugOrchestrations with both true and false test inputs to verify that optional XML tags are omitted cleanly when the condition is false.
  2. 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>).

Sources checked

Related guides

All guides

Let Workday check the work.

Kiweely writes WQL and builds orchestrations in your own tenant, and Workday, not Kiweely, says whether they passed.

Get the next guide in your inbox.

One email a month with new guides and one Extend tip. Nothing else.

We’ll email you once to confirm. Unsubscribe in one click from any issue.