Trace shows method used is Erp.Proxy.BO.POImpl GetNewPODetailAttch

How do I replicate this in customization code? I don’t see this as an option in the Adapters list. Or the reference list.

Erp.Proxy.BO.POImpl GetNewPODetailAttch

You would select the POAdapter, in the wizard, and then you can use the GetNewPODetailAttch method.

Ok. I was trying to use oTrans because the customization is on the POEntry form but I could not find that method under the transaction.

When you use the GetNewPOHeaderAttch method of the POAdapter, you get an error stating “POHeaderToPOHeaderAttch requires the child key values (DTSF, 37821) to exist in the parent table.” even though you send the PONum as a parameter of the method. This is true even if you use the GetByID method and load the PO before using the GetNewPOHeaderAttch method. We are in version 10.1.400.18. I guess I’ll try the XFileRef adapter.

Can you paste in the code you are trying?

It should be something like this.

POAdapter adapterPO = new POAdapter(this.oTrans);
adapterPO.BOConnect();
PODataSet POData;
POData = adapterPO.POData;
adapterPO.GetByID(101996);
adapterPO.GetNewPOHeaderAttch(101996);

Dan, Adding oTrans as the new POAdapter parameter instead of POEntryForm worked. Thanks!

For your info:

          Dim poAdpt As POAdapter = New POAdapter(oTrans)
          poAdpt.BOConnect()
          Dim gotPONum as Boolean = poAdpt.GetByID(PONum)
          if gotPONum = True then
            Dim gotPOAttch As Boolean = poAdpt.GetNewPOHeaderAttch(PONum)
            if gotPOAttch = True then
              poAdpt.POData.POHeaderAttch.Rows(0)("Company") = "CompanyNameHere"
              poAdpt.POData.POHeaderAttch.Rows(0)("PONum") = PONum
              poAdpt.POData.POHeaderAttch.Rows(0)("DrawDesc") = FileDesc
              poAdpt.POData.POHeaderAttch.Rows(0)("FileName") = FileName
              poAdpt.POData.POHeaderAttch.Rows(0)("DocTypeID") = "REQAttch"
              PoAdpt.POData.POHeaderAttch.Rows(0)("DrawingSeq") = DrawingSeq
              poAdpt.Update()
            else
              messagebox.show("Could not add attachment " & fileName)
            end if
          end if
          poAdpt.Dispose()
          oTrans.Refresh()

JPS

Great, remember to mark the topic as solved when you have time.