rubyworkday-api

Send additional data to Workday


I am working on sending some additional data for a workday using this endpoint Edit_Worker_Additional_Data. However, it lacks the documentation as what type of data they are expecting, hence, I am getting validation errors. I have tried various combinations but all in vain.

I took some guidance from this question but getting cus namespace error as I don't know where and how he initialized that namespace. Data for the custom field that I want to send:

Custom List T-Shirt Sizes
Custom Field Type Name T-Shirt Sizes
Web Service Alias tShirtSize
List Value Name Web Service Alias
M - Xs mXs
M - S Ms

Given below is the XML request body that I am sending

<soapenv:Body>
    <bsvc:Edit_Worker_Additional_Data_Request
      xmlns:bsvc="urn:com.workday/bsvc" bsvc:version="v38.1">
      <!-- Optional: -->
      <bsvc:Business_Process_Parameters>
        <!-- Optional: -->
        <bsvc:Auto_Complete>true</bsvc:Auto_Complete>
        <!-- Optional: -->
        <bsvc:Run_Now>true</bsvc:Run_Now>
      </bsvc:Business_Process_Parameters>
      <bsvc:Worker_Custom_Object_Data>
        <bsvc:Effective_Date>2022-11-18</bsvc:Effective_Date>
        <bsvc:Worker_Reference bsvc:Descriptor="string">
          <!-- Zero or more repetitions: -->
          <bsvc:ID bsvc:type="Employee_ID">3671</bsvc:ID>
        </bsvc:Worker_Reference>
        <bsvc:Business_Object_Additional_Data>
          <!-- You may enter ANY elements at this point -->
          <bsvc:tShirtSizes>
            <bsvc:tShirtSizesField>mXs</bsvc:tShirtSizesField>
          </bsvc:tShirtSizes>
        </bsvc:Business_Object_Additional_Data>
      </bsvc:Worker_Custom_Object_Data>
    </bsvc:Edit_Worker_Additional_Data_Request>
  </soapenv:Body>

Following are the validation errors that I am getting with different combinations

  • Invalid Subelement tShirtSizes-urn:com.workday/bsvc for element Effective_Dated_Web_Service_Additional_Data
  • Invalid Subelement T-Shirt_Sizes-urn:com.workday/bsvc for element Effective_Dated_Web_Service_Additional_Data

Solution

  • Since it was a custom list, I had to send the request like this:

    <bsvc:Edit_Worker_Additional_Data_Request>
      <bsvc:Business_Process_Parameters>
        <bsvc:Auto_Complete>true</bsvc:Auto_Complete>
        <bsvc:Run_Now>true</bsvc:Run_Now>
      </bsvc:Business_Process_Parameters>
      <bsvc:Worker_Custom_Object_Data>
        <bsvc:Effective_Date>2022-11-18</bsvc:Effective_Date>
        <bsvc:Worker_Reference>
          <bsvc:ID bsvc:type="Employee_ID">3671</bsvc:ID>
        </bsvc:Worker_Reference>
        <bsvc:Business_Object_Additional_Data>
          <cus:tshirt>
            <cus:size>
              <cus:ID cus:type='ExtendedAlias'>#{get_size}</cus:ID>
            </cus:size>
          </cus:tshirt>
        </bsvc:Business_Object_Additional_Data>
      </bsvc:Worker_Custom_Object_Data>
    </bsvc:Edit_Worker_Additional_Data_Request>