Snow-Shell/servicenow-powershell

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

Closed this issue · 3 comments

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

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.

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

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.