Solved

Unable to upload attachment on Purchase Receipts mobile screen

  • 14 June 2022
  • 2 replies
  • 36 views

Userlevel 2
Badge

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
}
}
}

 

icon

Best answer by Freeman Helmuth 14 June 2022, 18:14

View original

2 replies

Userlevel 2
Badge

Solved this issue. This error is related to how the Purchase Receipts MSDL is set up by default. The error in Visual Studio indicated a site map error so I started looking at how the screen was set up in the mobile site map.

For some reason, the Purchase Receipts list view on mobile was set up using a screen with the “expandSelector” option instead of using a GI like most other screens:
 

 

The fix was this(This is all in 2022 R1):

  1. Remove the Purchase Receipts Screen(PO302000) from the mobile workspace:

     

  2. Add the following code to the “Update MENU” section in a customization project. This re-arranges the site map so that the Purchase Receipts GI is the list view screen and the Purchase Receipts screen is a hidden screen:
    update folder "PurchaseReceipts"{
        add item "PO3020PL"{
          displayName = "Purchase Receipts"
          icon = "system://Box1"
        }
        
    remove item "PO302000"
      }
      
      
    add item "PO302000" {
          displayName = "Purchase Receipt"
          icon = "system://Box1"
          visible = false
      }
  3. Publish the customization project
  4. Add the MSDL to the Purchase Receipts(PO302000) screen to include attachments-see prior post for how to do that
  5. Add the Purchase Receipts GI(PO3020PL) to the mobile workspace.
  6. Add the MSDL for the Purchase Receipts GI(PO3020PL). Note, I added a few extra fields in my GI-customize these add field commands to your liking:
    add screen PO3020PL {
      add container "Result" {
        fieldsToShow = 7
        containerActionsToExpand = 2
        add field "ReceiptNbr"
        add field "VendorName" {
          weight = 2
        }
        add field "TypePOReceiptReceiptType"
        add field "Date"
        add field "Status"
        add field "Warehouse"
        add field "NoteText" {
          weight = 3
        }
        add containerAction "editDetail" {
          behavior = Open
          redirect = True
        }
        add containerAction "Insert" {
          icon = "system://Plus"
          behavior = Create
          redirect = True
        }
      }
    }
Userlevel 7
Badge

Thank you for sharing your solution @Freeman Helmuth !

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2022  Acumatica, Inc. All rights reserved