Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get a Summary Report of the number of changes in Workday for a time period
# how many changed objects
$changes = [xml]@'
<bsvc:Get_Workers_Request xmlns:bsvc="urn:com.workday/bsvc">
<bsvc:Request_Criteria>
<bsvc:Exclude_Inactive_Workers>true</bsvc:Exclude_Inactive_Workers>
<bsvc:Transaction_Log_Criteria_Data>
<bsvc:Transaction_Date_Range_Data>
<bsvc:Updated_From></bsvc:Updated_From>
<bsvc:Updated_Through></bsvc:Updated_Through>
</bsvc:Transaction_Date_Range_Data>
</bsvc:Transaction_Log_Criteria_Data>
</bsvc:Request_Criteria>
<bsvc:Response_Filter>
<bsvc:Page>1</bsvc:Page>
</bsvc:Response_Filter>
<bsvc:Response_Group>
<bsvc:Include_Reference>true</bsvc:Include_Reference>
<bsvc:Include_Personal_Information>false</bsvc:Include_Personal_Information>
<bsvc:Include_Employment_Information>false</bsvc:Include_Employment_Information>
<bsvc:Include_Compensation>false</bsvc:Include_Compensation>
<bsvc:Include_Organizations>false</bsvc:Include_Organizations>
<bsvc:Include_Roles>false</bsvc:Include_Roles>
<bsvc:Include_Worker_Documents>false</bsvc:Include_Worker_Documents>
</bsvc:Response_Group>
</bsvc:Get_Workers_Request>
'@
# minus 1 minute due to time skew between host running this and Workday
$timenow = (get-date).AddSeconds(-60)
$now = $timenow.ToString('o')
# Update Query Criteria - Get changes in the last 28 Days
$changes.Get_Workers_Request.Request_Criteria.Transaction_Log_Criteria_Data.Transaction_Date_Range_Data.Updated_Through = $now
$changes.Get_Workers_Request.Request_Criteria.Transaction_Log_Criteria_Data.Transaction_Date_Range_Data.Updated_From = $timenow.AddDays(-28).ToString('o')
# diaglog
write-host -ForegroundColor Green "Changes from: $($changes.Get_Workers_Request.Request_Criteria.Transaction_Log_Criteria_Data.Transaction_Date_Range_Data.Updated_From) TO: $($changes.Get_Workers_Request.Request_Criteria.Transaction_Log_Criteria_Data.Transaction_Date_Range_Data.Updated_Through)"
$response = Invoke-WorkdayRequest -Request $changes -Uri (Get-WorkdayEndpoint Human_Resources)
# output
write-output $response.Xml.Get_Workers_Response.Response_Results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment