Automate Zoho CRM Integration Tasks from PowerShell

Jerod Johnson
Jerod Johnson
Director, Technology Evangelism
Are you in search of a quick and easy way to access Zoho CRM data from PowerShell? This article demonstrates how to utilize the Zoho CRM Cmdlets for tasks like connecting to Zoho CRM data, automating operations, downloading data, and more.

The CData ADO.NET Provider for Zoho CRM is a standard ADO.NET Provider that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time and bidirectional access to Zoho CRM.

ADO.NET Provider

The ADO.NET Provider provides a SQL interface for Zoho CRM; this tutorial shows how to use the Provider to create, retrieve, update, and delete Zoho CRM data.

Once you have acquired the necessary connection properties, accessing Zoho CRM data in PowerShell can be enabled in three steps.

The connector is already registered with Zoho CRM as an OAuth application. As such, OAuth Credentials are embedded by default. If you would prefer to use your own custom OAuth app, see the Custom Credentials section in the Help documentation.

  1. Load the provider's assembly:

    
    [Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Zoho CRM\lib\System.Data.CData.ZohoCRM.dll")
        
  2. Connect to Zoho CRM:

     
    $conn= New-Object System.Data.CData.ZohoCRM.ZohoCRMConnection("InitiateOAuth=GETANDREFRESH;")
    $conn.Open()
    
  3. Instantiate the ZohoCRMDataAdapter, execute an SQL query, and output the results:

    
    $sql="SELECT Account_Name, Annual_Revenue from Accounts"
    
    $da= New-Object System.Data.CData.ZohoCRM.ZohoCRMDataAdapter($sql, $conn)
    $dt= New-Object System.Data.DataTable
    $da.Fill($dt)
    
    $dt.Rows | foreach {
    	Write-Host $_.account_name $_.annual_revenue
    }
      

Update Zoho CRM Data


$cmd =  New-Object System.Data.CData.ZohoCRM.ZohoCRMCommand("UPDATE Accounts SET Industry='Data/Telecom OEM' WHERE Id = @myId", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.ZohoCRM.ZohoCRMParameter("@myId","10456255-0015501366")))
$cmd.ExecuteNonQuery()

Insert Zoho CRM Data


$cmd =  New-Object System.Data.CData.ZohoCRM.ZohoCRMCommand("INSERT INTO Accounts (Industry) VALUES (@myIndustry)", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.ZohoCRM.ZohoCRMParameter("@myIndustry","Data/Telecom OEM")))
$cmd.ExecuteNonQuery()

Delete Zoho CRM Data


$cmd =  New-Object System.Data.CData.ZohoCRM.ZohoCRMCommand("DELETE FROM Accounts WHERE Id=@myId", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.ZohoCRM.ZohoCRMParameter("@myId","001d000000YBRseAAH")))
$cmd.ExecuteNonQuery()

Ready to get started?

Download a free trial of the Zoho CRM Data Provider to get started:

 Download Now

Learn more:

Zoho CRM Icon Zoho CRM ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with Zoho CRM data including Leads, Contacts, Opportunities, Accounts, and more!