Why Compound JSONPath Filters (|| and &&) Return Empty Results in Orchestrate
Workday Orchestrate supports compound logical comparison filters (|| and &&) inside [?(...)] predicates on Json member functions such as .objectAtJsonPath(), .valuesAtJsonPathAsArray(), and .iterator(). When a compound filter works in an external RFC 9535 JSONPath evaluator but returns empty data or fails in Orchestration Builder, one of three platform-specific issues is responsible:
1. Typographic (Curly) Single Quotes Inside [?(...)]
Copying a JSONPath expression from documentation, chat, or a rich-text editor frequently replaces straight ASCII single quotes (' / 0x27) with typographic curly quotes (‘ and ’):
// FAILS — curly quotes ‘ and ’ prevent matching and return empty results
$.data[?( @.employee.suporg.id == ‘e02485f863ec48d39a082bb95cc4abe4’ || @.employee.suporg.id == ‘1ad7d37487904a989b2db1bfa6fed57d’ )]Replace every quote inside the predicate with straight ASCII single quotes ('):
// WORKS — straight ASCII single quotes inside a single filter block
data.WorkerResponse.response
.asJSON()
.valuesAtJsonPathAsArray(
"$.data[?( @.employee.suporg.id == 'e02485f863ec48d39a082bb95cc4abe4' || @.employee.suporg.id == '1ad7d37487904a989b2db1bfa6fed57d' )]"
)2. Chained Filter Tokens ([?(...)][?(...)]) vs. Single && Predicate
As documented in Concept: JSONPath Support, Orchestration Builder explicitly rejects filter tokens followed by filter tokens:
| JSONPath Pattern | Support in Orchestrate | Behavior |
|---|---|---|
JSONPath Pattern$.data[?( @.hasAction == true )][?( @.employee.isTermed == false )] |
Support in OrchestrateNot Supported | BehaviorChained filter tokens fail validation or return empty results. |
JSONPath Pattern$.data[?( @.hasAction == true && @.employee.isTermed == false )] |
Support in OrchestrateSupported | BehaviorCombines both conditions using && inside a single [?( ... )] token. |
JSONPath Pattern$.data[?( @.id == $.defaultId )] |
Support in OrchestrateNot Supported | BehaviorFilters that refer to root ($) or compare two dynamic subqueries (@['a'] < @['b']) are not supported. |
3. objectAtJsonPath vs. valuesAtJsonPathAsArray on Filtered Arrays
A filter expression $.data[?(...)] evaluates against an array and can match zero, one, or multiple elements (up to Orchestrate’s 10,000-primitive JSONPath selection ceiling):
- Calling
.objectAtJsonPath("$.data[?(...)]")expects a single JSON object match. If you use a pre-check expression or callobjectAtJsonPathwhen multiple array elements match (or zero match withoutWithDefault), the pre-check fails. - Use
.countItemsAtJsonPath("$.data[?(...)]") > 0or.isValueAtJsonPath("$.data[?(...)]")for existence pre-checks, and.valuesAtJsonPathAsArray("$.data[?(...)]")or.iterator("$.data[?(...)]")to extract all matching array elements safely.
Using the Wildcard Operator (*) in stringAtXPathWithDefault and numberAtXPathWithDefault
When parsing Workday SOAP responses—such as extracting Parent_Event_Reference/ID from Launch_Integration_Event_Response or Total_Results from Get_Integration_Events_Response—Orchestration Builder supports the wildcard * and descendant // operators in stringAtXPathWithDefault and numberAtXPathWithDefault:
// Extract Parent_Event_Reference WID using wildcard prefixes for Envelope/Body
data.LaunchIntegrationSoap.response
.asXML()
.stringAtXPathWithDefault(
"/*/*/wd:Launch_Integration_Event_Response/wd:Integration_Event/wd:Integration_Event_Data/wd:Parent_Event_Reference/wd:ID[@wd:type='WID']",
""
)
// Extract Total_Results as a Number with a fallback of 0
data.GetIntegrationEventsSoap.response
.asXML()
.numberAtXPathWithDefault(
"/*/*/wd:Get_Integration_Events_Response/wd:Response_Results/wd:Total_Results",
0
)Why a Working Wildcard XPath Suddenly Returns the Default Value
If an orchestration with /*/*/Parent_Event_Reference/ID worked in one version or debug session and suddenly returns the default value ("" or 0), check these three XML rules:
- XML Namespace Prefixes (
wd:vs.excludeAllNamespaces()): Workday SOAP responses bind elements toxmlns:wd="urn:com.workday/bsvc". While/*/*matches the outer<env:Envelope>and<env:Body>regardless of namespace, named child elements (Parent_Event_Reference/ID) require thewd:prefix unless you strip namespaces first with.excludeAllNamespaces():javascript data.LaunchIntegrationSoap.response .asXML() .excludeAllNamespaces() .stringAtXPathWithDefault("/*/*/*/Integration_Event/Integration_Event_Data/Parent_Event_Reference/ID[@type='WID']", "") - Leaf-Node-Only Extraction Rule: In Orchestrate,
stringAtXPathWithDefaultandnumberAtXPathWithDefaultextract values from leaf nodes or attributes only. If the XPath points to a parent element that contains child tags (such asParent_Event_Referenceinstead ofParent_Event_Reference/wd:ID), the function returns no data. Onlyiterator(),fragmentAtXPath(), andcountItemsAtXPath()can select non-leaf XML fragments. - SOAP Fault Responses: If the SOAP call returned a
<SOAP-ENV:Fault>with HTTP 200 or 500,stringAtXPathWithDefaultevaluates against the fault XML and silently returns the default value"". Always checkdata.LaunchIntegrationSoap.response.isSoapFault().not()before extracting response fields.
Prefer Trigger Integration Over Manual SOAP Launch + XPath Polling
If you are calling Launch_Integration_Event_Request over SOAP and polling Get_Integration_Events_Request with numberAtXPathWithDefault to wait for a child integration to finish, replace both SOAP steps with Orchestrate’s native Trigger Integration component. Trigger Integration launches the child integration, pauses the parent orchestration automatically until the child integration completes, and exposes its status, messages, and output documents directly without XPath polling.
Verifying Your JSONPath and XPath Expressions in the Tenant
- In Orchestration Builder, test your JSONPath filter inside a Create Values step using
.countItemsAtJsonPath("$.data[?(...)]")and.valuesAtJsonPathAsArray("$.data[?(...)]")in DebugOrchestrations mode to verify the exact match count before consuming the result downstream. - For XML responses, inspect the raw XML step output in the debugger panel, verify whether namespace prefixes (
wd:orbsvc:) are present, and confirm the target node is a leaf element (wd:IDorwd:Total_Results).