ConnectWiseManageAPI icon indicating copy to clipboard operation
ConnectWiseManageAPI copied to clipboard

Bundling and Merging Tickets

Open PsychoData opened this issue 2 years ago • 2 comments

Hi,

I am trying to Bundle/Un-bundle, and possibly Merge tickets automatically and I am not seeing a clear way to do this through here.

It looks like the Bundle-ing may be through this endpoint and the Child>Parent Merge operation through this endpoint

For the un-bundling (removing children) I am thinking that Update-CWMTicket might work? But perhaps not, since I can't find a field that directly lists the ChildTicket IDs

I did try this, in hopes it would be able to mimic the /service/tickets/{parentId}/attachChildren path and Add 143061 as a child to 141378

$UpdateParam = @{
    ID = 141378
    Operation = 'add'
    Path = 'attachChildren'
    Value = $("childTicketIDs=143061")
}
Update-CWMTicket @UpdateParam -verbose

But it was attempting to essentially Patch the Ticket 141378 with a node attachChildren to the value of childTicketIDs=143061 Probably roughly equivalent to this method? patchServiceTicketsById

playing with Debugging.... this seems to work, but Invoke-CWMNewMaster isn't exposed as public

$paramlist = @{ 
   childTicketIds=@(143061)
}
Invoke-CWMNewMaster -Arguments $paramlist -Endpoint '/service/tickets/141378/attachChildren'

Which works! image

Or for invalid situations on Bundle

#Intentionally Trying to Merge a parent-with-children into a different ticket, which is invalid)

$paramlist = @{ 
    childTicketIds=@(141378)
} 
Invoke-CWMNewMaster -Arguments $paramlist -Endpoint '/service/tickets/143061/attachChildren'

it even gives helpful error messages Success: False Message: Error absorbing Service Ticket #141368 -- This record cannot be absorbed because the supplied Parent record is a child of another Ticket.

Still trying to figure out removing children/un-bundling Possibly set ParentID to empty/0 on Child tickets?

PsychoData avatar May 31 '22 09:05 PsychoData

ConnectWiseManageAPI.zip Thanks Kevin for the help, I fixed up the module so the function works without having to go into debug mode, I have not looked into unbundling but do appreciate your insight.

samkebab avatar Sep 19 '22 23:09 samkebab

@PsychoData, As far as I am aware, merging child tickets into a parent is a permanent action and cannot be undone once completed. I believe bundled tickets can be unbundled though, but I have not looked into how.

I've just submitted a pull request ( #49 ) which adds a New_CWMTicketChild function which can be used to either Bundle or Merge child ticket(s) into a parent ticket.

LMSJHaywood avatar Oct 11 '23 11:10 LMSJHaywood