Force canada
This commit is contained in:
@@ -127,7 +127,7 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Name="StreetBox" Style="{StaticResource RoundedTextBox}" Tag="Street Address" Grid.Column="0" Margin="0,0,8,0"/>
|
||||
<TextBox Name="CountryBox" Style="{StaticResource RoundedTextBox}" Tag="Country" Grid.Column="1"/>
|
||||
<TextBox Name="CountryBox" Style="{StaticResource RoundedTextBox}" Tag="Canada" Grid.Column="1"/>
|
||||
</Grid>
|
||||
|
||||
<!-- City + Province + Postal Code -->
|
||||
|
||||
2
main.ps1
2
main.ps1
@@ -105,6 +105,8 @@ $ITGlueBox.IsEnabled = $false
|
||||
$RocketcyberBox.IsEnabled = $false
|
||||
$CyberQPBox.IsEnabled = $false
|
||||
|
||||
$CountryBox.IsEnabled = $false
|
||||
|
||||
$AutotaskBox.Add_Checked({
|
||||
$PhoneBox.Visibility = 'Visible'
|
||||
$WebsiteBox.Visibility = 'Visible'
|
||||
|
||||
@@ -1,21 +1,30 @@
|
||||
function Invoke-AutotaskProvision {
|
||||
param (
|
||||
[Parameter(Mandatory)][string]$CompanyName,
|
||||
[Parameter(Mandatory)][string]$PhoneNumber,
|
||||
[Parameter(Mandatory)]
|
||||
[string]$CompanyName,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[string]$PhoneNumber,
|
||||
|
||||
[string]$Website,
|
||||
[string]$Street,
|
||||
[string]$City,
|
||||
[string]$Province,
|
||||
[string]$PostalCode,
|
||||
[string]$Country,
|
||||
[Parameter(Mandatory)][hashtable]$Credentials
|
||||
[string]$Country, # Not used but accepted for compatibility
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[hashtable]$Credentials
|
||||
)
|
||||
|
||||
if (-not $Credentials["AutotaskURL"] -or -not $Credentials["AutotaskIntCode"] -or -not $Credentials["AutotaskUsername"] -or -not $Credentials["AutotaskSecret"]) {
|
||||
if (-not $Credentials["AutotaskURL"] -or
|
||||
-not $Credentials["AutotaskIntCode"] -or
|
||||
-not $Credentials["AutotaskUsername"] -or
|
||||
-not $Credentials["AutotaskSecret"]) {
|
||||
throw "Missing Autotask credentials in hashtable."
|
||||
}
|
||||
|
||||
$Url = "https://$($Credentials["AutotaskURL"])/atservicesrest/v1.0/companies"
|
||||
$BaseUrl = "https://$($Credentials["AutotaskURL"])/atservicesrest/v1.0/companies"
|
||||
|
||||
$Headers = @{
|
||||
"ApiIntegrationcode" = $Credentials["AutotaskIntCode"]
|
||||
@@ -38,7 +47,7 @@ function Invoke-AutotaskProvision {
|
||||
} | ConvertTo-Json -Depth 3
|
||||
|
||||
try {
|
||||
$Response = Invoke-RestMethod -Uri $Url -Method Post -Headers $Headers -Body $Body
|
||||
$Response = Invoke-RestMethod -Uri $BaseUrl -Method Post -Headers $Headers -Body $Body
|
||||
return $Response.itemId, $Response.id, $Response.companyID, $Response.item.id | Where-Object { $_ } | Select-Object -First 1
|
||||
} catch {
|
||||
throw "[Autotask] Provisioning failed: $($_.Exception.Message)"
|
||||
|
||||
Reference in New Issue
Block a user