Jump to content

Error when posting receiveddate in UpdateOtherReceipt in .NET SDK


 Share

Recommended Posts

Our project uses the .NET SDK to post data to Intacct. When functionality is not available in the SDK, we build a custom wrapper using the .NET SDK AbstractFunction tools. In this scenario, we can create OtherReceipts using the existing SDK object (Intacct.SDK.Functions.CashManagement.OtherReceiptCreate). Since no corresponding object exists for updating an OtherReceipt, we built our own by implementing AbstractOtherReceipt.

You can see from the code below that I have attempted to include "receiveddate" which is valid according to the API documentation for update_otherreceipt. However, when I run this, I get an error message:

Response control status failure - XL03000003 XML Parse schema error: Error 1871: Element 'receiveddate': This element is not expected. Expected is one of ( description, supdocid, currency, exchratedate, exchratetype, exchrate, customfields, inclusivetax, receiptitems ).. Line: 1, column: 0. [Support ID: WMQJV%7EZbKYbWEYBRH6qXb4YLP5fwAAAAY]

This works as expected if I remove the "receiveddate" line.

Am I structuring this correctly, or is the list of fields that I get back the only fields that I can update?

public class OtherReceiptUpdate : AbstractOtherReceipt
{
    public int RecordNo { get; set; }
    public OtherReceiptUpdate()
        : base()
    {
    }
    public OtherReceiptUpdate(string controlId = null)
        : base(controlId)
    {
    }
    public override void WriteXml(ref IaXmlWriter xml)
    {
        xml.WriteStartElement("function");
        xml.WriteAttribute("controlid", ControlId, true);
        xml.WriteStartElement("update_otherreceipt");
        xml.WriteAttribute("key", RecordNo, true);                
        xml.WriteElement("refid", TransactionNo);                            
        //xml.WriteElement("receiveddate", TransactionDate, IaXmlWriter.IntacctDateFormat);  
        xml.WriteStartElement("receiptitems");      
        if (Lines.Count > 0)
        {
            foreach (AbstractOtherReceiptLine line in Lines)
            {
                line.WriteXml(ref xml);
            }
        }
        xml.WriteEndElement(); // receiptitems
        xml.WriteEndElement(); // update_otherreceipt             
        xml.WriteEndElement(); // function           
    }
}

Thank you!

Joe Donahue

Link to comment
Share on other sites

  • Members

I just tested in my demo company and I was able to update the receiveddate. Here is my sample API call that was successful.

I would recommend look at your logs and see what XML structure is being created and sent to Sage Intacct and make sure it matches this.

<content>
  <function controlid="testControlId">
    <update_otherreceipt key="1445">
      <receiveddate>
        <year>2024</year>
        <month>01</month>
        <day>23</day>
      </receiveddate>
    </update_otherreceipt>
  </function>
</content>

 

Link to comment
Share on other sites

Louis, thank you for the quick reply and the information. This seems to correlate with my approach, but I'm still getting the same message back that receiveddate "is not expected." I don't immediately have access to the XML output but will see what I can do.

Is it possible that the error message is coming from the SDK? I noticed that AbstractOtherReceipt calls this field ReceiptDate and not receiveddate. It may not be related, but I wonder if passing this through the SDK hits a layer of validation before it actually generates & sends the XML.

https://intacct.github.io/intacct-sdk-net/class_intacct_1_1_s_d_k_1_1_functions_1_1_cash_management_1_1_abstract_other_receipt.html

Link to comment
Share on other sites

Louis,

I made the recommended change to the formatting of the receiveddate element. In addition, I was able to enable logging and capture the XML messages. Surprisingly, the updated format looks correct, but I am still getting the exact same error message.
 

<function controlid="0be78e3c-47d1-4fed-ac0c-ee9a201ababc">
  <update_otherreceipt key="4090">
    <refid>Mateo Receipt - 256749</refid>
    <receiveddate>
      <year>2024</year>
      <month>01</month>
      <day>06</day>
    </receiveddate>
    <receiptitems>
      <updatelineitem line_num="1"><amount>10.00</amount></updatelineitem>
    </receiptitems>
  </update_otherreceipt>
</function>

Response control status failure - XL03000003 XML Parse schema error: Error 1871: Element 'receiveddate': This element is not expected. Expected is one of ( description, supdocid, currency, exchratedate, exchratetype, exchrate, customfields, inclusivetax, receiptitems ).. Line: 1, column: 0. [Support ID: 4plML%7EZbfbRWEcBW86HZp32_DNJwAAAAo]

Link to comment
Share on other sites

  • Members

The order of the fields matters here. refid is in the wrong position. This works however it looks like you have a smart rule preventing the update at this point.

 

  <function controlid="0be78e3c-47d1-4fed-ac0c-ee9a201ababc">
    <update_otherreceipt key="4090">
      <receiveddate>
        <year>2024</year>
        <month>01</month>
        <day>06</day>
      </receiveddate>
      <refid>Mateo Receipt - 256749</refid>
      <receiptitems>
        <updatelineitem line_num="1">
          <amount>10.00</amount>
        </updatelineitem>
      </receiptitems>
    </update_otherreceipt>
  </function>

 

  • Thanks 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...