Closed Absoblogginlutely closed 1 year ago
Found that the issue was the type parameter. Discovered with
$scheds=Get-CWMScheduleEntry -condition 'dateentered > [2022-12-29T04:26:06Z] and Member/Name = "My Username "'
$scheds | select * | out-gridview
In my case type needs to be set to 4. I also added the -allowScheduleConflictsFlag $true to allow a new schedule entry to be added at the same time as a previously existing schedule entry. It looks like a type id of 1 is a outlook meeting that has been synchronized over to connectwise and type 4 is a normal connectwise schedule item.
This enabled me to check the type. Complete code to add a schedule entry -
$ticket=123456
$nextdate=(convertto-cwmtime "2022/12/30 15:00").replace("[","").replace("]","")
$nextdateend=(convertto-cwmtime "2022/12/30 16:00").replace("[","").replace("]","")
new-cwmscheduleentry -member @{identifier='myusername'} -objectId $ticket -dateStart $nextdate -dateEnd $nextdateend -status @{Name='Firm'} -reminder @{name='15 minutes'} -type @{id=4} -where @{name="Remote"} -allowScheduleConflictsFlag $true
Hope this helps someone. Useful case example for this is to add several techs to a known ticket in the future at the same time in a much quicker way than adding them through the connectwise scheduling interface
Trying to create a new schedule item on a ticket to follow up in the next week or so. Through trial and error I've almost got it working but stumped on associating the time to a ticket.
`new-cwmscheduleentry -member @{identifier='ahelsby'} -objectid 123456 -dateStart "2022-12-20T14:00:00Z" -dateEnd "2022-12-20T15:00:00Z" -status @{Name='Firm'} -reminder @{name='15 minutes'} -type @{id=1}
This gives an error of
Now sure why it's trying to create an activity? I've tried against a project ticket and a service ticket to see if that makes any difference. I've also passed the entire ticket object to the objectid parameter but that doesn't work either (unsurprisingly)
I also had to convert the start and end time to Connectwise Time and then strip off the [] otherwise I got an invalid time message.