Skip to main content
Solved

Unable to upload attachment on Purchase Receipts mobile screen


Freeman Helmuth
Varsity III
Forum|alt.badge.img

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

 

Best answer by Freeman Helmuth

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
        }
      }
    }
View original
Did this topic help you find an answer to your question?

2 replies

Freeman Helmuth
Varsity III
Forum|alt.badge.img

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

Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2640 replies
  • June 14, 2022

Thank you for sharing your solution @Freeman Helmuth !


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings