0

For the life of me, I just cannot seem to get this to work. Here is the situation: I am trying to add the already existing customer custom field (already had a definition, but no value) to an estimate that I am currently creating via QBSDK 12. So far, I can add the estimate, the custom fields to the line items, but not the custom fields belonging to the customer in the estimate header area (reserved for customer information).

Here is my attempted code for the header (doesn't work):

        If Not (DE.sconProof(x) Is Nothing) Or Not (DE.sconProof(x) = "") Then
      Dim DataExtModRq As IDataExtMod
     DataExtModRq = requestMsgSet.AppendDataExtModRq
             ' DataExtModRq.ORListTxn.TxnDataExt.TxnID.SetValue(sEstID)


      DataExtModRq.OwnerID.SetValue("0")
      DataExtModRq.DataExtName.SetValue("Proof Required")
      DataExtModRq.ORListTxn.TxnDataExt.TxnDataExtType.SetValue(ENTxnDataExtType.tdetEstimate)
      DataExtModRq.ORListTxn.ListDataExt.ListObjRef.FullName.SetValue(DE.sconCompany(x))
      DataExtModRq.DataExtValue.SetValue(DE.sconProof(x))
    End If

Here is my working code for line items within the estimate (Does work):

          If Not DE.sitemDateNeeded(i) = "" Then
         Dim DataExt53 As IDataExt
         DataExt53 = EstimateLineAdder.EstimateLineAdd.DataExtList.Append()
         'Set field value for OwnerID
         DataExt53.OwnerID.SetValue("0")
         DataExt53.DataExtName.SetValue("In Hands By")
         'Set field value for DataExtValue
         DataExt53.DataExtValue.SetValue(DE.sitemDateNeeded(i))
      End If
      If Not DE.sitemSPC(i) = "" Then
         Dim DataExt54 As IDataExt
         DataExt54 = EstimateLineAdder.EstimateLineAdd.DataExtList.Append
         DataExt54.DataExtName.SetValue("SPC")
         DataExt54.DataExtValue.SetValue(DE.sitemSPC(i))
      End If

The error message say's I am missing the TxnID but I am not modifying the estimate, I am creating a new one. I have tried the "IDataExt" as well but that doesn't work any better. If I need to save the newly created estimate, and then go back and add the TxnID, that would be really weird, and I'm not sure of a simple way to do that. I should be able to add data to the custom field in the header portion of the estimate without going through so much "hoopla". Please help me if you know the answer.

1 Answers1

0

I figured it out...

    If Not (DE.sconProof(x) Is Nothing) Or Not (DE.sconProof(x) = "") Then
      Dim DataExtModRq As IDataExtMod
     DataExtModRq = requestMsgSet.AppendDataExtModRq

      DataExtModRq.DataExtName.SetValue("Proof Required")
      DataExtModRq.DataExtValue.SetValue(DE.sconProof(x))
      DataExtModRq.OwnerID.SetValue("0")
      'DataExtModRq.ORListTxn.TxnDataExt.TxnDataExtType.SetValue(ENTxnDataExtType.tdetEstimate)
      DataExtModRq.ORListTxn.ListDataExt.ListDataExtType.SetValue(ENListDataExtType.ldetCustomer)
      DataExtModRq.ORListTxn.ListDataExt.ListObjRef.FullName.SetValue(DE.sconCompany(x))
      'DataExtModRq.ORListTxn.TxnDataExt.TxnID.SetValue(sTxnID)


    End If