Monday 28 September 2020

Extracting Multiple Nodes from Hierarchy - Working with XSL Transformation

 Hello All, 

Recently i was working on a integration where i was getting multiple errors in case of failures.

I was first planning to use FINS Industry XML service for the Error property extraction or Workflow Utility Echo, but these business services have limitations that they can only get one Node/Process Property from the hierarchy. i.e. return the first matching node in case multiple child are present at same level .

In the below XML if we try getting the Value of Error Code, using any Siebel provide vanilla business service ,we will only get "ErrorCode:500" and not the other nodes.

so, to get multiple Node we need to write custom Business Service that traverses the Hierarchy and do looing, that can be a bit confusing and requires multiple looping.


here, SiebelMessage.GetChild(0) is the IO instance

SiebelMessage.GetChild(0).GetChild(0) is the IC Instance

SiebelMessage.GetChild(0).GetChild(0).GetProperty("ErrorCode") is the location of process property we need to extract

XSL to the Rescue :-)

Well not a traditional approach, but yes we can use XSL for the multiple Node extraction, and that too without writing a custom BS. The code is pretty simple and can get to any level of hierarchy.

Below code Searches for ErrorCode and ErrorMessage under XMLResult/ErrorDetails path and uses for-each loop to iterate and get the values 

the final Result looks like, 

ErrorCode: 5002 ErrorMessage: The JSON value could not be converted to System 

ErrorCode: 5003 ErrorMessage: The Total value cannot be Negative. 

ErrorCode:5004 ErrorMessage: The Taxes must be passed in Input

I will share more details on how to use this in workflow in my next post, till then happy exploring

No comments:

Post a Comment

Siebel GoTo View - Handling Realtime cases

 Hello All,  We all must have used GoTo view functionality of siebel to navigate to a particular view from current view. What if the require...