Skip to content

Commit 42527f0

Browse files
committed
add new ci function, needs default fields
1 parent 17a6fd1 commit 42527f0

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

ServiceNow/Public/New-ServiceNowConfigurationItem.ps1

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ function New-ServiceNowConfigurationItem {
8585

8686
process {
8787
# Create a hash table of any defined parameters (not CustomFields) that have values
88-
# $DefinedIncidentParameters = @('AssignmentGroup', 'Caller', 'Category', 'Comment', 'ConfigurationItem', 'Description', 'ShortDescription', 'Subcategory')
8988
$definedParams = @{
9089
'Name' = 'name'
9190
}
@@ -95,22 +94,6 @@ function New-ServiceNowConfigurationItem {
9594
$tableEntryValues.Add($definedParams.$key, $PSBoundParameters.$key)
9695
}
9796
}
98-
# ForEach ($Parameter in $DefinedIncidentParameters) {
99-
# If ($null -ne $PSBoundParameters.$Parameter) {
100-
# # Turn the defined parameter name into the ServiceNow attribute name
101-
# $KeyToAdd = Switch ($Parameter) {
102-
# AssignmentGroup { 'assignment_group'; break }
103-
# Caller { 'caller_id'; break }
104-
# Category { 'category'; break }
105-
# Comment { 'comments'; break }
106-
# ConfigurationItem { 'cmdb_ci'; break }
107-
# Description { 'description'; break }
108-
# ShortDescription { 'short_description'; break }
109-
# Subcategory { 'subcategory'; break }
110-
# }
111-
# $TableEntryValues.Add($KeyToAdd, $PSBoundParameters.$Parameter)
112-
# }
113-
# }
11497

11598
# Add CustomFields hash pairs to the Table Entry Values hash table
11699
$dupes = ForEach ($Key in $CustomFields.Keys) {
@@ -126,7 +109,7 @@ function New-ServiceNowConfigurationItem {
126109

127110
# Throw an error if duplicate fields were provided
128111
If ($dupes) {
129-
throw ('Ticket fields may only be used once and you have redefined ''{0}'' in $CustomFields' -f ($dupes -join ","))
112+
throw ('You are attempting to redefine a value, ''{0}'', with $CustomFields that is already set' -f ($dupes -join ","))
130113
}
131114

132115
# Table Entry Splat

0 commit comments

Comments
 (0)