I’m having a strange bug/problem with attachments on the Purchase Receipts screen.
If I create a purchase receipt from a purchase order and then try to upload an attachment, it succeds:
However when I try to upload an attachment by navigating directly to a Purchase Receipt, I get the following error “Object reference not set to an instance of an object”. Here you can see that it is the same record, but in this case I have navigated to the Purchase Receipt directly.
Out of the box, the purchase receipts screen does not allow uploading of attachments. I’ve added that functionality to the MSDL using this code(all of the screen code is posted below):
update screen PO302000 {
update container "DocumentSummary" {
formActionsToExpand = 2
remove field "PostPeriod"
remove field "CreateBill"
remove field "Location"
remove recordAction "Assign"
attachments {
disabled = False
imageAdjustmentPreset = Receipt
add type "jpg" {
extension = "jpg"
}
add type "png" {
extension = "png"
}
add type "pdf" {
extension = "pdf"
}
}
add field "NoteText" {
displayName = "Receipt Notes"
textType = PlainMultiLine
}
add recordAction "AddPOOrder" {
displayName = "Select Purchase Order(s)"
behavior = Void
redirect = True
redirectToContainer = "AddPurchaseOrder$List"
}
add recordAction "AddTransfer" {
displayName = "Select Transfer Order(s)"
behavior = Void
redirect = True
redirectToContainer = "AddTransferOrder$List"
}
}
update container "Details" {
remove field "Subitem"
remove field "Branch"
remove field "ExpirationDate"
remove field "LotSerialNbr"
remove field "CompletePOLine"
remove field "TransferLineNbr"
remove field "TransferOrderNbr"
remove field "TransferOrderType"
update field "InventoryID" {
formPriority = 100
}
update field "TransactionDescr" {
formPriority = 95
}
update field "UOM" {
formPriority = 90
}
update field "ReceiptQty" {
formPriority = 85
}
update field "OrderedQty" {
formPriority = 80
}
update field "OpenQty" {
formPriority = 75
}
update field "Warehouse" {
formPriority = 65
}
update field "Location" {
formPriority = 60
}
update field "LineType" {
formPriority = 55
}
attachments {
disabled = False
imageAdjustmentPreset = Receipt
add type "jpg" {
extension = "jpg"
}
add type "png" {
extension = "png"
}
add type "pdf" {
extension = "pdf"
}
}
add field "NoteText" {
displayName = "Item Notes"
textType = PlainMultiLine
}
}
add container "AddPurchaseOrder" {
visible = False
fieldsToShow = 6
listActionsToExpand = 2
formActionsToExpand = 3
containerActionsToExpand = 2
type = SelectionActionList
add field "OrderNbr"
add field "Description" {
weight = 2
}
add field "Status"
add field "NoteText" {
weight = 2
}
add field "Date"
add listAction "AddPOOrder2" {
displayName = "Add & Close"
behavior = Void
after = close
}
}
add container "AddTransferOrder" {
visible = False
fieldsToShow = 6
listActionsToExpand = 2
formActionsToExpand = 3
containerActionsToExpand = 2
type = SelectionActionList
add field "ShipmentNbr"
add field "Description" {
weight = 2
}
add field "FromWarehouse"
add field "OrderNbr"
add field "Date"
add listAction "AddTransfer2" {
displayName = "Add & Close"
behavior = Void
after = close
}
}
}