Skip to content

Commit

Permalink
Changed selectedItem to scriptscope so it is available in all events
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasRossmeisl committed Nov 30, 2022
1 parent b32044f commit 6492c3e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Files/powerEvents/Events/TransferERPBomViaFileTab.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Set-LogFilePath -Path $logPath


Add-VaultTab -Name 'ERP BOM' -EntityType 'File' -Action {
param($selectedFile)
param($Script:SelectedItem)

$erpBomTab_control = [Windows.Markup.XamlReader]::Load([System.Xml.XmlNodeReader]::new([xml](Get-Content "$PSScriptRoot\TransferERPBomTab.xaml")))

Expand All @@ -61,7 +61,7 @@ Add-VaultTab -Name 'ERP BOM' -EntityType 'File' -Action {

$erpItemTab_GoToBOMButton = $erpBomTab_control.FindName('GoToBomButton')

$erpBomHeader = Get-ERPObject -EntitySet "BomHeaders" -Keys @{Number = $selectedFile._PartNumber } -Expand "BomRows"
$erpBomHeader = Get-ERPObject -EntitySet "BomHeaders" -Keys @{Number = $Script:SelectedItem._PartNumber } -Expand "BomRows"
if(-not $?) {
$statusMessage_label.Content = $Error[0]
$statusMessage_label.Foreground = "Red"
Expand Down
6 changes: 3 additions & 3 deletions Files/powerEvents/Events/TransferERPBomViaItemTab.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Set-LogFilePath -Path $logPath


Add-VaultTab -Name 'ERP BOM' -EntityType 'Item' -Action {
param($selectedItem)
param($Script:SelectedItem)

$erpBomTab_control = [Windows.Markup.XamlReader]::Load([System.Xml.XmlNodeReader]::new([xml](Get-Content "$PSScriptRoot\TransferERPBomTab.xaml")))

Expand All @@ -61,7 +61,7 @@ Add-VaultTab -Name 'ERP BOM' -EntityType 'Item' -Action {

$erpItemTab_GoToBOMButton = $erpBomTab_control.FindName('GoToBomButton')

$erpBomHeader = Get-ERPObject -EntitySet "BomHeaders" -Keys @{Number = $selectedItem._Number } -Expand "BomRows"
$erpBomHeader = Get-ERPObject -EntitySet "BomHeaders" -Keys @{Number = $Script:SelectedItem._Number } -Expand "BomRows"
if(-not $?) {
$statusMessage_label.Content = $Error[0]
$statusMessage_label.Foreground = "Red"
Expand All @@ -85,7 +85,7 @@ Add-VaultTab -Name 'ERP BOM' -EntityType 'Item' -Action {
$erpItemTab_ShowBomWindowButton.Add_Click({
param($Sender, $EventArgs)

Show-BomWindow -Entity $selectedItem
Show-BomWindow -Entity $Script:SelectedItem
[System.Windows.Forms.SendKeys]::SendWait("{F5}")
})

Expand Down

0 comments on commit 6492c3e

Please sign in to comment.