Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Project Ticket #43

Open
JB0710 opened this issue Jun 20, 2023 · 1 comment
Open

Add Project Ticket #43

JB0710 opened this issue Jun 20, 2023 · 1 comment

Comments

@JB0710
Copy link

JB0710 commented Jun 20, 2023

Trying to add a project ticket via PowerShell, when I use the -project with New-CWMTicket I get "New-CWMTicket : Cannot process argument transformation on parameter 'project'. Cannot convert the "386" value of type "System.Int32" to type "System.Collections.Hashtable".

Any assistance would be greatly appreciated!

Here is my code:

$CWMConnectionInfo = @{
   Server      = 'na.myconnectwise.net'
   Company     = 'BLANK'
   pubkey      = 'BLANK'
   privatekey  = 'BLANK'
   clientid    = 'BLANK'
}

# Install/Update/Load the module
if(Get-InstalledModule 'ConnectWiseManageAPI' -ErrorAction SilentlyContinue){ Update-Module 'ConnectWiseManageAPI' -Verbose }
else{ Install-Module 'ConnectWiseManageAPI' -Verbose }
Import-Module 'ConnectWiseManageAPI'

# Connect to your Manage server
Connect-CWM @CWMConnectionInfo -Force -Verbose

# Choose a company to make test a ticket for
#$Companies = Get-CWMCompany -all
#$Company = $Companies | Select-Object ID, Name | Out-GridView -OutputMode Single -Title 'Select Company'
$Company = '457'
$Project = '386'

$NewTicketParameters = @{
    summary = 'Install N-Central Agent on FWGLEX31LPTP'
    # We want to pass Manage objects as hash tables
    company           =    @{"identifier" = "$Company"}
    contactName = 'BLANK'
    contactPhoneNumber = 'BLANK'
    contactEmailAddress = 'BLANK'
   
}

$NewTicket = New-CWMTicket @NewTicketParameters -project $Project

# To clear your connection information from memory you can terminate the session or issue the disconnect command.
Disconnect-CWM
@Absoblogginlutely
Copy link

Long time since you posted this, but in case it helps others, you need to pass the project through as a hash table too. That will fix this particular experience but it will still show up as a service ticket.
$newticket = new-cwmticket @NewTicketParameters -project @{id=$project}

Or you can add this to your NewTicketParameters splat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants