Skip to content

Commit

Permalink
Fixing last updated asset not properly updating.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjantzen committed Feb 10, 2022
1 parent 43cbe3a commit 2386dbe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions User_Billing_Update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2131,7 +2131,7 @@ if ($ScriptsLast_FlexAssetID -and $orgID) {
Write-Host "Created a new 'Scripts - Last Run' page."
}

if ($LastUpdatedPage) {
if ($LastUpdatedPage -and $LastUpdatedPage.data) {
# Update asset with last run times for the user audit
$UserCleanupTime = $LastUpdatedPage.data.attributes.traits."contact-audit"
if ($UserCleanupUpdateRan) {
Expand All @@ -2146,14 +2146,14 @@ if ($ScriptsLast_FlexAssetID -and $orgID) {
$UserO365ReportUpdateTime = (Get-Date).ToString("yyyy-MM-dd")
}

$FlexAssetBody =
$LastUpdated_FlexAssetBody =
@{
type = 'flexible-assets'
attributes = @{
traits = @{
"name" = "Scripts - Last Run"

"current-version" = $CurrentVersion
"current-version" = "$($CurrentVersion | Out-String)"
"contact-audit" = $UserCleanupTime
"contact-audit-monitoring-disabled" = $LastUpdatedPage.data.attributes.traits."contact-audit-monitoring-disabled"
"billing-update-ua" = $UserBillingUpdateTime
Expand Down Expand Up @@ -2196,11 +2196,11 @@ if ($ScriptsLast_FlexAssetID -and $orgID) {
}
}
# Filter out empty values
($FlexAssetBody.attributes.traits.GetEnumerator() | Where-Object { -not $_.Value }) | Foreach-Object {
$FlexAssetBody.attributes.traits.Remove($_.Name)
($LastUpdated_FlexAssetBody.attributes.traits.GetEnumerator() | Where-Object { -not $_.Value }) | Foreach-Object {
$LastUpdated_FlexAssetBody.attributes.traits.Remove($_.Name)
}

Set-ITGlueFlexibleAssets -id $LastUpdatedPage.data.id -data $FlexAssetBody
Set-ITGlueFlexibleAssets -id $LastUpdatedPage.data.id -data $LastUpdated_FlexAssetBody
Write-Host "Updated the 'Scripts - Last Run' page."
}
}
Expand Down
2 changes: 1 addition & 1 deletion currentversion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.11.0
2.11.1

0 comments on commit 2386dbe

Please sign in to comment.