This function is executed when clicking the “Transfer” button within the Item Tab.
All the Items from the BOM Window can be transferred to to ERP.

Transfer-Items [-Items] <Item[]>

TypeNameDescriptioninput/outputMandatoryDefault value
Item[]ItemsThe items which should be transferred.inputYes


Each unique Item shown in the BOM Window with another Status then Unknown will be passed to this function.

It is recommended to update the Status of all the Items with the Update-BomWindowEntity cmdlet.

When an exception is thrown within this function, the BOM Window shows the Exception message of the terminated Transfer operation.
The Status of all the Items that where not updated, gets automatically changed to Unknown.

Remove all the items with Status “Remove” from ERP. When operation succeeded the item gets removed from the Dialog, otherwise item is marked as “Error”:

function Transfer-Items($items) {
	foreach($item in $items) {
		if($item._Status -eq 'Remove'){
			$removed = Remove-ERPObject -EntitySet 'Materials' -Keys @{'Number'=$item._PartNumber}
			if($removed) {
				$item | Remove-BomWindowEntity
				$item | Update-BomWindowEntity -Status 'Error' -ToolTip "Error occured when removing item: $($Error[0].Exception.Message)"