Skip to content

Commit 825296a

Browse files
committed
Lost Update-ServiceNowIncident in merge. Adding it back.
1 parent 4dc7ef3 commit 825296a

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
function Update-ServiceNowIncident {
2+
Param
3+
( # sys_id of the caller of the incident (user Get-ServiceNowUser to retrieve this)
4+
[parameter(mandatory=$true)]
5+
[parameter(ParameterSetName='SpecifyConnectionFields', mandatory=$true)]
6+
[parameter(ParameterSetName='UseConnectionObject', mandatory=$true)]
7+
[parameter(ParameterSetName='SetGlobalAuth', mandatory=$true)]
8+
[string]$SysId,
9+
10+
# Hashtable of values to use as the record's properties
11+
[parameter(mandatory=$true)]
12+
[hashtable]$Values,
13+
14+
# Credential used to authenticate to ServiceNow
15+
[Parameter(ParameterSetName='SpecifyConnectionFields', Mandatory=$True)]
16+
[ValidateNotNullOrEmpty()]
17+
[PSCredential]
18+
$ServiceNowCredential,
19+
20+
# The URL for the ServiceNow instance being used (eg: instancename.service-now.com)
21+
[Parameter(ParameterSetName='SpecifyConnectionFields', Mandatory=$True)]
22+
[ValidateNotNullOrEmpty()]
23+
[string]
24+
$ServiceNowURL,
25+
26+
#Azure Automation Connection object containing username, password, and URL for the ServiceNow instance
27+
[Parameter(ParameterSetName='UseConnectionObject', Mandatory=$True)]
28+
[ValidateNotNullOrEmpty()]
29+
[Hashtable]
30+
$Connection
31+
)
32+
33+
if ($Connection -ne $null)
34+
{
35+
Update-ServiceNowTableEntry -Table 'incident' -Values $Values -Connection $Connection -SysId $SysId
36+
}
37+
elseif ($ServiceNowCredential -ne $null -and $ServiceNowURL -ne $null)
38+
{
39+
Update-ServiceNowTableEntry -Table 'incident' -Values $Values -ServiceNowCredential $ServiceNowCredential -ServiceNowURL $ServiceNowURL -SysId $SysId
40+
}
41+
else
42+
{
43+
Update-ServiceNowTableEntry -Table 'incident' -Values $Values -SysId $SysId
44+
}
45+
}

0 commit comments

Comments
 (0)