Close a requested item #144
-
How do I close a requested item using the powershell? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @fbcarvalho. Closing a requested item typically involves closing all the attached catalog items and then the requested item automatically closes. This is going to get a lot easier in the next release I'm currently working on, but for now with 2.x you can perform the following: # get the requested item sys_id
$sysId = Get-ServiceNowRecord -Table 'Requested Item' -Filter @('number','-eq','ritmxxxxxx') -Property sys_id | Select -ExpandProperty sys_id # replace ritmxxxxxx with your actual number
# set catalog tasks to closed complete
Get-ServiceNowRecord -Table sc_task -Filter @('request_item', '-eq', $sysId) | Update-ServiceNowRecord -Table sc_task -Values @{'state'='Closed Complete'} You may or may not have additional fields that must be populated when closing a task. If so, you'll need to add those values to |
Beta Was this translation helpful? Give feedback.
Hi @fbcarvalho. Closing a requested item typically involves closing all the attached catalog items and then the requested item automatically closes. This is going to get a lot easier in the next release I'm currently working on, but for now with 2.x you can perform the following:
Yo…