Automate FinancialForce Integration Tasks from PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

FinancialForce ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with FinancialForce.



Are you looking for a quick and easy way to access FinancialForce data from PowerShell? We show how to use the Cmdlets for FinancialForce and the CData ADO.NET Provider for FinancialForce to connect to FinancialForce data and synchronize, automate, download, and more.

The CData Cmdlets for FinancialForce 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 FinancialForce.

Cmdlets or ADO.NET?

The cmdlets are not only a PowerShell interface to the FinancialForce API, but also an SQL interface; this tutorial shows how to use both to create, retrieve, update, and delete FinancialForce data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for FinancialForce. To access FinancialForce data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for FinancialForce.

After obtaining the needed connection properties, accessing FinancialForce data in PowerShell consists of three basic steps.

There are several authentication methods available for connecting to FinancialForce: login credentials, SSO, and OAuth.

Authenticating with a Login and Token

Set the User and Password to your login credentials. Additionally, set the SecurityToken. By default, the SecurityToken is required, but you can make it optional by allowing a range of trusted IP addresses.

To disable the security token:

  1. Log in to FinancialForce and enter "Network Access" in the Quick Find box in the setup section.
  2. Add your IP address to the list of trusted IP addresses.

To obtain the security token:

  1. Open the personal information page on FinancialForce.com.
  2. Click the link to reset your security token. The token will be emailed to you.
  3. Specify the security token in the SecurityToken connection property or append it to the Password.

Authenticating with OAuth

If you do not have access to the user name and password or do not want to require them, use the OAuth user consent flow. See the OAuth section in the Help for an authentication guide.

Connecting to FinancialForce Sandbox Accounts

Set UseSandbox to true (false by default) to use a FinancialForce sandbox account. Ensure that you specify a sandbox user name in User.

PowerShell

  1. Install the module:

    Install-Module FinancialForceCmdlets
  2. Connect:

    $financialforce = Connect-FinancialForce -User "$User" -Password "$Password" -Security Token "$Security Token"
  3. Search for and retrieve data:

    $industry = "Floppy Disks" $account = Select-FinancialForce -Connection $financialforce -Table "Account" -Where "Industry = `'$Industry`'" $account

    You can also use the Invoke-FinancialForce cmdlet to execute SQL commands:

    $account = Invoke-FinancialForce -Connection $financialforce -Query 'SELECT * FROM Account WHERE Industry = @Industry' -Params @{'@Industry'='Floppy Disks'}

ADO.NET

  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.FinancialForce.FinancialForceConnection("User=myUser;Password=myPassword;Security Token=myToken;InitiateOAuth=GETANDREFRESH") $conn.Open()
  3. Instantiate the FinancialForceDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT BillingState, Name from Account" $da= New-Object System.Data.CData.FinancialForce.FinancialForceDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.billingstate $_.name }

Update FinancialForce Data

PowerShell

Update-FinancialForce -Connection $FinancialForce -Columns @('BillingState','Name') -Values @('MyBillingState', 'MyName') -Table Account -Id "MyId"

ADO.NET

$cmd = New-Object System.Data.CData.FinancialForce.FinancialForceCommand("UPDATE Account SET Industry='Floppy Disks' WHERE Id = @myId", $conn) $cmd.Parameters.Add(new System.Data.CData.FinancialForce.FinancialForceParameter("@myId","10456255-0015501366")) $cmd.ExecuteNonQuery()

Insert FinancialForce Data

PowerShell

Add-FinancialForce -Connection $FinancialForce -Table Account -Columns @("BillingState", "Name") -Values @("MyBillingState", "MyName")

ADO.NET

$cmd = New-Object System.Data.CData.FinancialForce.FinancialForceCommand("INSERT INTO Account (Industry) VALUES (@myIndustry)", $conn) $cmd.Parameters.Add(new System.Data.CData.FinancialForce.FinancialForceParameter("@myIndustry","Floppy Disks")) $cmd.ExecuteNonQuery()

Delete FinancialForce Data

PowerShell

Remove-FinancialForce -Connection $FinancialForce -Table "Account" -Id "MyId"

ADO.NET

$cmd = New-Object System.Data.CData.FinancialForce.FinancialForceCommand("DELETE FROM Account WHERE Id=@myId", $conn) $cmd.Parameters.Add(new System.Data.CData.FinancialForce.FinancialForceParameter("@myId","001d000000YBRseAAH")) $cmd.ExecuteNonQuery()