-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6a162a4
commit efee4c4
Showing
6 changed files
with
119 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
function Get-ServiceNowChangeRequest { | ||
param( | ||
# Machine name of the field to order by | ||
[parameter(mandatory=$false)] | ||
[string]$OrderBy='opened_at', | ||
|
||
# Direction of ordering (Desc/Asc) | ||
[parameter(mandatory=$false)] | ||
[ValidateSet("Desc", "Asc")] | ||
[string]$OrderDirection='Desc', | ||
|
||
# Maximum number of records to return | ||
[parameter(mandatory=$false)] | ||
[int]$Limit=10, | ||
|
||
# Hashtable containing machine field names and values returned must match exactly (will be combined with AND) | ||
[parameter(mandatory=$false)] | ||
[hashtable]$MatchExact=@{}, | ||
|
||
# Hashtable containing machine field names and values returned rows must contain (will be combined with AND) | ||
[parameter(mandatory=$false)] | ||
[hashtable]$MatchContains=@{}, | ||
|
||
# Whether or not to show human readable display values instead of machine values | ||
[parameter(mandatory=$false)] | ||
[ValidateSet("true","false", "all")] | ||
[string]$DisplayValues='true' | ||
) | ||
|
||
$private:Query = New-ServiceNowQuery -OrderBy $private:OrderBy -OrderDirection $private:OrderDirection -MatchExact $private:MatchExact -MatchContains $private:MatchContains | ||
|
||
$private:result = Get-ServiceNowTable -Table 'change_request' -Query $private:Query -Limit $private:Limit -DisplayValues $private:DisplayValues; | ||
|
||
# Add the custom type to the change request to enable a view | ||
$private:result | %{$_.psobject.TypeNames.Insert(0, "PSServiceNow.ChangeRequest")} | ||
return $private:result | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Configuration> | ||
<ViewDefinitions> | ||
<View> | ||
<Name>PSServiceNow.ChangeRequest</Name> | ||
<ViewSelectedBy> | ||
<TypeName>PSServiceNow.ChangeRequest</TypeName> | ||
</ViewSelectedBy> | ||
<TableControl> | ||
<TableHeaders> | ||
<TableColumnHeader> | ||
<Width>20</Width> | ||
</TableColumnHeader> | ||
<TableColumnHeader /> | ||
<TableColumnHeader> | ||
<Width>20</Width> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>assigned_to</Label> | ||
<Width>20</Width> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Width>20</Width> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Label>cmdb_ci</Label> | ||
<Width>30</Width> | ||
</TableColumnHeader> | ||
<TableColumnHeader> | ||
<Width>20</Width> | ||
</TableColumnHeader> | ||
</TableHeaders> | ||
<TableRowEntries> | ||
<TableRowEntry> | ||
<TableColumnItems> | ||
<TableColumnItem> | ||
<PropertyName>number</PropertyName> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<PropertyName>short_description</PropertyName> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<PropertyName>state</PropertyName> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<ScriptBlock> | ||
$_.assigned_to.display_value | ||
</ScriptBlock> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<PropertyName>approval</PropertyName> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<ScriptBlock> | ||
$_.cmdb_ci.display_value | ||
</ScriptBlock> | ||
</TableColumnItem> | ||
<TableColumnItem> | ||
<PropertyName>opened_at</PropertyName> | ||
</TableColumnItem> | ||
|
||
</TableColumnItems> | ||
</TableRowEntry> | ||
</TableRowEntries> | ||
</TableControl> | ||
</View> | ||
</ViewDefinitions> | ||
</Configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters