The issue you are encountering is likely due to a conflict or a missing JavaScript resource within the custom PowerShell script dialog in Sitecore. The error Uncaught ReferenceError: scForm is not defined indicates that the Sitecore form handling JavaScript (scForm) is not being properly loaded or referenced.
Here is an example of how you might include the Receive-File command
# Define the parent item
$parentItemPath = "master:/sitecore/content/your/path"
$parentItem = Get-Item -Path $parentItemPath
# Check if the item exists
if ($parentItem -eq $null) {
Write-Host "Parent item not found at path: $parentItemPath" -ForegroundColor Red
return
}
# Invoke the file receive dialog
Receive-File -ParentItem $parentItem -OverwriteIfExists $false -Complete {
param($uploadedFile)
if ($uploadedFile -eq $null) {
Write-Host "File upload failed or file already exists." -ForegroundColor Yellow
} else {
Write-Host "File uploaded successfully: $($uploadedFile.Name)" -ForegroundColor Green
}
}
Check JavaScript Console: Inspect the browser console for any additional errors that might give more context to the issue.
Verify SPE Installation: Ensure that the Sitecore PowerShell Extensions are correctly installed and configured in your Sitecore environment.
Hope the above steps resolves your broken popup.