ISC - Workday Connector xPath issue

Trying to figure out what the correct Workday xPath would be for returning the ‘Primary_Job’ for a user.

Here is a snippet of the soapUI return envelope:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
   <env:Body>
      <wd:Get_Workers_Response wd:version="v32.0" xmlns:wd="urn:com.workday/bsvc">
         <wd:Response_Data>
            <wd:Worker>
               <wd:Worker_Reference>
                  <wd:ID wd:type="WID">ege5bf762b95107cb5cdc808497ceb4f</wd:ID>
                  <wd:ID wd:type="Employee_ID">123456</wd:ID>
               </wd:Worker_Reference>
               <wd:Worker_Descriptor>S, Rosa M</wd:Worker_Descriptor>
               <wd:Worker_Data>
                  <wd:Worker_ID>123456</wd:Worker_ID>
                  <wd:User_ID>user1oo</wd:User_ID>
                  <wd:Employment_Data>
                     <wd:Worker_Job_Data wd:Primary_Job="1">
                        <wd:Position_Data wd:Effective_Date="2021-08-29">
                           <wd:Position_Reference>
                              <wd:ID wd:type="WID">ege5bf762b95107cb5cdc808497ceb4f</wd:ID>
                              <wd:ID wd:type="Position_ID">00079436</wd:ID>
                           </wd:Position_Reference>

I have tried various versions of this:

"PRIMARY_POSITION_ID": "ns1:Worker_Data/ns1:Employment_Data[(ns1:Worker_Job_Data[@ns1:Primary_Job]='1')]/ns1:Position_Data/ns1:Position_Reference/ns1:ID[@ns1:type='Position_ID']",

For POSITION_ID, which will return all ‘Position_ID’, this will work but I also want to just return the Primary_Job.

"POSITION_ID": "ns1:Worker_Data/ns1:Employment_Data/ns1:Worker_Job_Data[*]/ns1:Position_Data/ns1:Position_Reference/ns1:ID[@ns1:type='Position_ID']",

I have also tried:
“PRIMARY_POSITION_ID”: “ns1:Worker_Data/ns1:Employment_Data[ns1:Worker_Job_Data[@ns1:type=‘Primary_Job’]=‘1’]/ns1:Position_Data/ns1:Position_Reference/ns1:ID[@ns1:type=‘Position_ID’]”,

I discovered recently that the namespace differs between what you get when you call the Workday API directly or when the connector does it (wd: vs ns1:). In that, the flags that are used in (amongst others) the primary field are not ‘1’ but ‘true’. So
“ns1:Worker_Data/ns1:Employment_Data[ns1:Worker_Job_Data[@ns1:type=‘Primary_Job’]=‘1’]/ns1:Position_Data/ns1:Position_Reference/ns1:ID[@ns1:type=‘Position_ID’]”,

Should become
“ns1:Worker_Data/ns1:Employment_Data[ns1:Worker_Job_Data[@ns1:type=‘Primary_Job’]=‘true’]/ns1:Position_Data/ns1:Position_Reference/ns1:ID[@ns1:type=‘Position_ID’]”,

Please give that a shot and report back!

So I tried what you suggested and it didn’t work.

`"PRIMARY_POSITION_ID": "ns1:Worker_Data/ns1:Employment_Data[ns1:Worker_Job_Data[@ns1:type='Primary_Job']='true']/ns1:Position_Data/ns1:Position_Reference/ns1:ID[@ns1:type='Position_ID']",`

I also tried the following with making true to TRUE, which also didn’t work

“PRIMARY_POSITION_ID”: “ns1:Worker_Data/ns1:Employment_Data[ns1:Worker_Job_Data[@ns1:type=‘Primary_Job’]=‘TRUE’]/ns1:Position_Data/ns1:Position_Reference/ns1:ID[@ns1:type=‘Position_ID’]”,

Hello Scott,
Can you please try below Xpath for Primary_Position_ID and let me know.

ns1:Worker_Data/ns1:Employment_Data/ns1:Worker_Job_Data[ns1:Worker_Job_Data[@ns1:Primary_Job=‘1’]/ns1:Position_Reference[@ns1:type=‘Position_ID’]]

Also are you using ns1 or wd in your Source XPath for other attributes?
Thanks!!

Santosh

Hello Santosh,

I tried what you suggest but had to change to ‘1’ and ‘Position_ID’, which did not work.

"PRIMARY_POSITION_ID": "ns1:Worker_Data/ns1:Employment_Data/ns1:Worker_Job_Data[ns1:Worker_Job_Data[@ns1:Primary_Job='1']/ns1:Position_Reference[@ns1:type='Position_ID']]",

Here are some of the other xPath that I currently use on the Workday Connector, which do work. All of my xPaths are using ns1: and not wd:

            "TERMINATION_DATE": "ns1:Worker_Data/ns1:Employment_Data/ns1:Worker_Status_Data/ns1:Termination_Date",
            "PREFERRED_LAST_NAME": "ns1:Worker_Data/ns1:Personal_Data/ns1:Name_Data/ns1:Preferred_Name_Data/ns1:Name_Detail_Data/ns1:Last_Name ",
            "COST_CENTER_REFERENCE_ID": "ns1:Worker_Data/ns1:Organization_Data/ns1:Worker_Organization_Data/ns1:Organization_Data[ns1:Organization_Type_Reference[ns1:ID[@ns1:type='Organization_Type_ID']='COST_CENTER']]/ns1:Organization_Reference_ID | ns1:Worker_Data/ns1:Organization_Data/ns1:Worker_Organization_Data/ns1:Organization_Data[ns1:Organization_Type_Reference[ns1:ID[@ns1:type='Organization_Type_ID']='Cost_Center']]/ns1:Organization_Reference_ID",
            "LEGAL_LAST_NAME": "ns1:Worker_Data/ns1:Personal_Data/ns1:Name_Data/ns1:Legal_Name_Data/ns1:Name_Detail_Data/ns1:Last_Name",
            "END_EMPLOYMENT_REASON": "ns1:Worker_Data/ns1:Employment_Data/ns1:Worker_Job_Data/ns1:Position_Data/ns1:End_Employment_Reason_Reference/@ns1:Descriptor",

Hello Scott,
Please try this below Xpath and let me know.

ns1:Worker_Data/ns1:Employment_Data/ns1:Worker_Job_Data[@ns1:Primary_Job=‘1’]/ns1:Position_Data/ns1:Position_Reference/ns1:ID[@ns1:type=‘Position_ID’]

Santosh

Note: copy this xpath first to notepad++ and try removing and adding back the single quotes for ‘1’ and ‘Position_ID’.

Hello Santosh,

I updated the WD Connector with this below and unfortunately it still did not work.

"PRIMARY_POSITION_ID": "ns1:Worker_Data/ns1:Employment_Data/ns1:Worker_Job_Data[@ns1:Primary_Job='1']/ns1:Position_Data/ns1:Position_Reference/ns1:ID[@ns1:type='Position_ID']",

Just to point out again, I use the below to grab All position IDs for someone. Just need to separately grab the Primary_Job in a different attribute;

"POSITION_ID": "ns1:Worker_Data/ns1:Employment_Data/ns1:Worker_Job_Data[*]/ns1:Position_Data/ns1:Position_Reference/ns1:ID[@ns1:type='Position_ID']",

Hello Scott,
Please try below Xpath
For Position ID:
ns1:Worker_Data/ns1:Employment_Data/ns1:Worker_Job_Data/ns1:Position_Data/ns1:Position_Reference/ns1:ID[@ns1:type=‘Position_ID’]

For Primary Job:
ns1:Worker_Data/ns1:Employment_Data[ns1:Worker_Job_Data[@ns1:type='Primary_Job=‘1’]]

I did tried in mine and it is pulling the expected data from the source after aggregation.

Regards,
Santosh

Santosh,

I did add, which did not work. I did a single aggregation of the user in question. Did you do a single aggregation or did you do a full aggregation of the Source itself?

"PRIMARY_POSITION_ID": "ns1:Worker_Data/ns1:Employment_Data[ns1:Worker_Job_Data[@ns1:type='Primary_Job='1']]",

Hello Scott,
I did full aggregation

Can you try below xpath to see if you are pulling any data?

ns1:Worker_Data/ns1:Employment_Data[ns1:Worker_Job_Data[@ns1:type=‘Primary_Job’]='1’]

Are you using the Workday connector that leverages a virtual appliance, or the Workday SaaS connector? The SaaS connector expects a namespace of wd rather than the ns1 used in the non-SaaS connector.

I am using the connector that uses the namespace of ‘ns1’. Remember I already have a bunch of xPaths that are working, which all are using ‘ns1:’. This is the only xPath I am having an issue with returning data.

I just tried, with a single aggregation, that did not work. I am going to kickoff a full aggregation and see what happens. I expect it to still fail since I have updated other xPaths before, done a single aggregation and saw the expected updated information/attribute value(s).

"PRIMARY_POSITION_ID": "ns1:Worker_Data/ns1:Employment_Data[ns1:Worker_Job_Data[@ns1:type='Primary_Job']='1']",
1 Like

Try this:
ns1:Worker_Data/ns1:Employment_Data/ns1:Worker_Job_Data[@ns1:Primary_Job="1"]/ns1:Position_Data/ns1:Position_Reference/ns1:ID[@ns1:type="Position_ID"]

Mark,

I tried below, which also did not work. I had to use a single quote where you showed double quotes. VSCode would not let me save the changes if I didn’t

PRIMARY_POSITION_ID": "ns1:Worker_Data/ns1:Employment_Data/ns1:Worker_Job_Data[@ns1:Primary_Job='1']/ns1:Position_Data/ns1:Position_Reference/ns1:ID[@ns1:type='Position_ID']",

Hi Scott

One more for you to try (tested with Oxygen):

ns1:Worker_Data/ns1:Employment_Data[ns1:Worker_Job_Data/@ns1:Primary_Job="1"]/ns1:Worker_Job_Data/ns1:Position_Data/ns1:Position_Reference/ns1:ID[@ns1:type="Position_ID"]

Hi Jeremy,

I tried the following with no luck.

"PRIMARY_POSITION_ID":"ns1:Worker_Data/ns1:Employment_Data[ns1:Worker_Job_Data/@ns1:Primary_Job='1']/ns1:Worker_Job_Data/ns1:Position_Data/ns1:Position_Reference/ns1:ID[@ns1:type='Position_ID']",

TBH, I’m confused. I had a typo in my earlier response, but @sup3rmark answer should work, it’s the correct xpath

What did you get: multiple values or zero values?