In Progress Compensation Include XQuery Expressions

You can determine if an in progress task should be compensated by writing an XQuery expression in the Design Studio Task Editor Compensation tab.

Note:

If the XQuery expression is invalid OSM logs the error and includes the in progress task in the compensation plan as it defaults the expression to true.

This section refers to the Design Studio OSM Automated Task or Manual Task editor, Compensation tab, In Progress Compensation Include Expression XQuery field for dynamically defining when in progress tasks should be included in compensation. This XQuery expression runs when OSM first analyzes the task for compensation:

  • Context: The context for this XQuery is the current task order data. You can get the current task order data using the XML API GetOrder.Response function.

  • Prolog: You can declare the XML API namespace to use the GetOrder.Response function in the XQuery body to extract the order information.

    For example:

    declare namespace osm = "urn:com:metasolv:oms:xmlapi:1";
    declare namespace log =  "java:org.apache.commons.logging.Log";
    
    declare variable $log external; 
    declare variable $context external;
    
  • Body: Based on task context data, the body must return true if the in progress task requires compensation or false if it does not.

For example:

declare namespace osm = "urn:com:metasolv:oms:xmlapi:1";
declare namespace log =  "java:org.apache.commons.logging.Log";
declare variable $log external; 
 
let $inputDoc := self::node()
let $value := $inputDoc/GetOrder.Response/_root/data
 
return (
    if (fn:contains($value, "includeInCompensation")) then
        fn:true()
    else
        fn:false()
)