Skip to content

Close a requested item #144

Answered by gdbarron
fbcarvalho asked this question in Q&A
Jul 8, 2021 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

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'}

Yo…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fbcarvalho
Comment options

Answer selected by gdbarron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants