A few days ago, I was ๐ ๏ธ thinking to create a command for PACX that allowed me to call via command line the new Dataverse AI functions ๐ ๏ธ.
But I'm lazy, so I try to avoid reinventing the wheel when there is one there already available that just fits my needs.
Here is how you can invoke the ๐ค Dataverse AI ๐ค actions via Powershell leveraging Microsoft.Xrm.Data.PowerShell
:
# setup a connection towards your dataverse environment
$conn = Get-CrmConnection -ConnectionString $connStr
# invoke the action
$response = Invoke-CrmAction -conn $conn -Name AIReply -Parameters @{ Text = "Compute the square root of PI" }
# print out the response
$response
Recently I've also known about this powershell library by Rob Wood and... this is how to do the same via Rnwood.Dataverse.Data.PowerShell
.
# install the powershell module
Install-Module Rnwood.Dataverse.Data.PowerShell -Scope CurrentUser
# setup a connection towards your dataverse environment
$c = Get-DataverseConnection -url https://myorg.crm4.dynamics.com -interactive
# create the request
$request = new-object Microsoft.Xrm.Sdk.OrganizationRequest "AIReply"
$request["Text"] = "Can you compute the square root of PI?"
$response = Invoke-DataverseRequest -connection $c -request $request
# print out the response
$response
Et voilร :
Of course it works with any organization request ๐
References:
Top comments (0)