Snow-Shell / servicenow-powershell

PowerShell module to automate ServiceNow service and asset management. This module can be used standalone, with Azure Automation, or Docker.
Apache License 2.0
359 stars 170 forks source link

Cannot Close Sctask that requires text in worknotes field not posted and closed task clicked in gui #245

Closed chathamdl closed 12 months ago

chathamdl commented 1 year ago

Our Service now instance requires unposted work notes on close for sctask in the gui. With the code below the notes post, but the task does not close.

Example code: $inputdata = @{State = 'Closed'; 'work_notes' = 'Wintel does not do this Skipping Task'} Update-ServiceNowRecord -Table 'Task' -ID SCTASK2767059 -InputData $inputdata -PassThru

gdbarron commented 1 year ago

Hey @chathamdl. Have you tried to make both of these changes at the same time via the UI and been successful? If so, my only other suggestion would be to try the enum value for State instead of the value equivalent.

chathamdl commented 1 year ago

Yep we have to do them at the same time in the gui, and the note cannot be posted, you have to hit close task at the top for it to properly close the task. I had them add my Api user to Assignment group the sctask was assigned as well still not working.

Output from Powershell PS C:\WINDOWS\system32> $inputdata = @{State = '4'; 'work_notes' = 'Wintel does not do this Skipping Task'} PS C:\WINDOWS\system32> Update-ServiceNowRecord -Table 'Task' -ID SCTASK2767059 -InputData $inputdata -PassThru number state sys_class_name parent sys_id


SCTASK276... 1 sc_task 1ab29d7bc307a11cef8f1d4ce0013162

chathamdl commented 1 year ago

Our ServiceNow team is under new mgmt and they are basically starting over, due to all the costumization, so it could be that I guess. Thanks for replying.