![]() |
VOOZH | about |
The CData Cmdlets for Workday are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time and bidirectional access to Workday.
CData provides the easiest way to access and integrate live data from Workday. Customers use CData connectivity to:
Users frequently integrate Workday with analytics tools such as Tableau, Power BI, and Excel, and leverage our tools to replicate Workday data to databases or data warehouses. Access is secured at the user level, based on the authenticated user's identity and role.
For more information on configuring Workday to work with CData, refer to our Knowledge Base articles: Comprehensive Workday Connectivity through Workday WQL and Reports-as-a-Service & Workday + CData: Connection & Integration Best Practices.
The Cmdlets are not only a PowerShell interface to Workday, but also an SQL interface; this tutorial shows how to use both to create, retrieve, update, and delete Workday data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Workday. To access Workday data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Workday.
Once you have acquired the necessary connection properties, accessing Workday data in PowerShell can be enabled in three steps.
To connect to Workday, users need to find the Tenant and BaseURL and then select their API type.
To obtain the BaseURL and Tenant properties, log into Workday and search for "View API Clients." On this screen, you'll find the Workday REST API Endpoint, a URL that includes both the BaseURL and Tenant.
The format of the REST API Endpoint is: https://domain.com/subdirectories/mycompany, where:
The value you use for the ConnectionType property determines which Workday API you use. See our Community Article for more information on Workday connectivity options and best practices.
| API | ConnectionType Value |
|---|---|
| WQL | WQL |
| Reports as a Service | Reports |
| REST | REST |
| SOAP | SOAP |
Your method of authentication depends on which API you are using.
See the Help documentation for more information on configuring OAuth with Workday.
Install the module:
Install-Module WorkdayCmdlets
Connect:
$workday = Connect-Workday -User "$User" -Password "$Password" -Tenant "$Tenant" -BaseURL "$BaseURL" -ConnectionType "$ConnectionType" -InitiateOAuth "$InitiateOAuth"
Search for and retrieve data:
$legal_name_last_name = "Morgan" $workers = Select-Workday -Connection $workday -Table "Workers" -Where "Legal_Name_Last_Name = `'$Legal_Name_Last_Name`'" $workers
You can also use the Invoke-Workday cmdlet to execute SQL commands:
$workers = Invoke-Workday -Connection $workday -Query 'SELECT * FROM Workers WHERE Legal_Name_Last_Name = @Legal_Name_Last_Name' -Params @{'@Legal_Name_Last_Name'='Morgan'}
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Workday\lib\System.Data.CData.Workday.dll")
Connect to Workday:
$conn= New-Object System.Data.CData.Workday.WorkdayConnection("User=myuser;Password=mypassword;Tenant=mycompany_gm1;BaseURL=https://wd3-impl-services1.workday.com;ConnectionType=WQL;InitiateOAuth=GETANDREFRESH;")
$conn.Open()
Instantiate the WorkdayDataAdapter, execute an SQL query, and output the results:
$sql="SELECT Worker_Reference_WID, Legal_Name_Last_Name from Workers"
$da= New-Object System.Data.CData.Workday.WorkdayDataAdapter($sql, $conn)
$dt= New-Object System.Data.DataTable
$da.Fill($dt)
$dt.Rows | foreach {
Write-Host $_.worker_reference_wid $_.legal_name_last_name
}
Update-Workday -Connection $Workday -Columns @('Worker_Reference_WID','Legal_Name_Last_Name') -Values @('MyWorker_Reference_WID', 'MyLegal_Name_Last_Name') -Table Workers -Id "MyId"
$cmd = New-Object System.Data.CData.Workday.WorkdayCommand("UPDATE Workers SET Legal_Name_Last_Name='Morgan' WHERE Id = @myId", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.Workday.WorkdayParameter("@myId","10456255-0015501366")))
$cmd.ExecuteNonQuery()
Add-Workday -Connection $Workday -Table Workers -Columns @("Worker_Reference_WID", "Legal_Name_Last_Name") -Values @("MyWorker_Reference_WID", "MyLegal_Name_Last_Name")
$cmd = New-Object System.Data.CData.Workday.WorkdayCommand("INSERT INTO Workers (Legal_Name_Last_Name) VALUES (@myLegal_Name_Last_Name)", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.Workday.WorkdayParameter("@myLegal_Name_Last_Name","Morgan")))
$cmd.ExecuteNonQuery()
Remove-Workday -Connection $Workday -Table "Workers" -Id "MyId"
$cmd = New-Object System.Data.CData.Workday.WorkdayCommand("DELETE FROM Workers WHERE Id=@myId", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.Workday.WorkdayParameter("@myId","001d000000YBRseAAH")))
$cmd.ExecuteNonQuery()
CodeProject
Download a free trial of the Workday Data Provider to get started:
Download NowLearn more:
👁 Workday IconRapidly create and deploy powerful .NET applications that integrate with Workday.