Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions ServiceNow/Public/Update-ServiceNowRequestItem.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
function Update-ServiceNowRequestItem {
Param
( # sys_id of the caller of the Request Item (use Get-ServiceNowUser to retrieve this)
[parameter(mandatory=$true)]
[parameter(ParameterSetName='SpecifyConnectionFields', mandatory=$true)]
[parameter(ParameterSetName='UseConnectionObject', mandatory=$true)]
[parameter(ParameterSetName='SetGlobalAuth', mandatory=$true)]
[string]$SysId,

# Hashtable of values to use as the record's properties
[parameter(mandatory=$true)]
[hashtable]$Values,

# Credential used to authenticate to ServiceNow
[Parameter(ParameterSetName='SpecifyConnectionFields', Mandatory=$True)]
[ValidateNotNullOrEmpty()]
[PSCredential]$ServiceNowCredential,

# The URL for the ServiceNow instance being used (eg: instancename.service-now.com)
[Parameter(ParameterSetName='SpecifyConnectionFields', Mandatory=$True)]
[ValidateNotNullOrEmpty()]
[string]$ServiceNowURL,

#Azure Automation Connection object containing username, password, and URL for the ServiceNow instance
[Parameter(ParameterSetName='UseConnectionObject', Mandatory=$True)]
[ValidateNotNullOrEmpty()]
[Hashtable]$Connection
)

$updateServiceNowTableEntrySplat = @{
SysId = $SysId
Table = 'sc_req_item'
Values = $Values
}

# Update the splat if the parameters have values
if ($null -ne $PSBoundParameters.Connection)
{
$updateServiceNowTableEntrySplat.Add('Connection',$Connection)
}
elseif ($null -ne $PSBoundParameters.ServiceNowCredential -and $null -ne $PSBoundParameters.ServiceNowURL)
{
$updateServiceNowTableEntrySplat.Add('ServiceNowCredential',$ServiceNowCredential)
$updateServiceNowTableEntrySplat.Add('ServiceNowURL',$ServiceNowURL)
}

Update-ServiceNowTableEntry @updateServiceNowTableEntrySplat
}

2 changes: 1 addition & 1 deletion ServiceNow/ServiceNow.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ FormatsToProcess = @('ServiceNow.format.ps1xml')
NestedModules = @()

# Functions to export from this module
FunctionsToExport = @('Add-ServiceNowAttachment','Get-ServiceNowAttachment','Get-ServiceNowAttachmentDetail','Get-ServiceNowChangeRequest','Get-ServiceNowConfigurationItem','Get-ServiceNowIncident','Get-ServiceNowRequest','Get-ServiceNowRequestItem','Get-ServiceNowTable','Get-ServiceNowTableEntry','Get-ServiceNowUser','Get-ServiceNowUserGroup','New-ServiceNowChangeRequest','New-ServiceNowIncident','New-ServiceNowQuery','New-ServiceNowTableEntry','Remove-ServiceNowAttachment','Remove-ServiceNowAuth','Remove-ServiceNowTableEntry','Set-ServiceNowAuth','Test-ServiceNowAuthIsSet','Update-ServiceNowChangeRequest','Update-ServiceNowIncident','Update-ServiceNowNumber','Update-ServiceNowTableEntry')
FunctionsToExport = @('Add-ServiceNowAttachment','Get-ServiceNowAttachment','Get-ServiceNowAttachmentDetail','Get-ServiceNowChangeRequest','Get-ServiceNowConfigurationItem','Get-ServiceNowIncident','Get-ServiceNowRequest','Get-ServiceNowRequestItem','Get-ServiceNowTable','Get-ServiceNowTableEntry','Get-ServiceNowUser','Get-ServiceNowUserGroup','New-ServiceNowChangeRequest','New-ServiceNowIncident','New-ServiceNowQuery','New-ServiceNowTableEntry','Remove-ServiceNowAttachment','Remove-ServiceNowAuth','Remove-ServiceNowTableEntry','Set-ServiceNowAuth','Test-ServiceNowAuthIsSet','Update-ServiceNowChangeRequest','Update-ServiceNowIncident','Update-ServiceNowNumber','Update-ServiceNowRequestItem','Update-ServiceNowTableEntry')

# List of all modules packaged with this module
# ModuleList = @()
Expand Down