Skip to content

Commit 9c0347d

Browse files
admcSHx - Simon Heather ADMadmcSHx - Simon Heather ADM
authored andcommitted
Add DateFormat global variable and comment based help
1 parent 705f8aa commit 9c0347d

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed
Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,38 @@
11
function Set-ServiceNowAuth{
2-
param(
2+
<#
3+
.SYNOPSIS
4+
Configures default connection settings for the Service-Now Instance
5+
.DESCRIPTION
6+
The Set-ServiceNowAuth function configures default connection settings for the Service-Now Instance. These include the instance URL,
7+
authentication credentials and date format.
8+
.INPUTS
9+
None
10+
.OUTPUTS
11+
System.Boolean
12+
.LINK
13+
Service-Now Kingston Release REST API Reference: https://docs.servicenow.com/bundle/kingston-application-development/page/build/applications/concept/api-rest.html
14+
Service-Now Table API FAQ: https://hi.service-now.com/kb_view.do?sysparm_article=KB0534905
15+
#>
16+
param(
17+
# The URL for the ServiceNow instance being used
318
[parameter(mandatory=$true)]
419
[string]$url,
520

21+
# Credential used to authenticate to ServiceNow
622
[parameter(mandatory=$true)]
7-
[System.Management.Automation.PSCredential]$Credentials
8-
)
23+
[System.Management.Automation.PSCredential]$Credentials,
24+
25+
# The date format specified in the Service-Now Instance, sys_properties table, property glide.sys.data_format. This is required
26+
# to correctly convert datetime fields to the local computer locale format when the DisplayValues parameter of the Get-* functions
27+
# is set to true
28+
[parameter(mandatory=$false)]
29+
[String]$DateFormat=(Get-Culture).DateTimeFormat.ShortDatePattern+' '+(Get-Culture).DateTimeFormat.LongTimePattern
30+
)
31+
932
$Global:ServiceNowURL = 'https://' + $url
1033
$Global:ServiceNowRESTURL = $ServiceNowURL + '/api/now/v1'
1134
$Global:ServiceNowCredentials = $credentials
35+
$Global:ServiceNowDateFormat = $DateFormat
36+
1237
return $true;
1338
}

0 commit comments

Comments
 (0)