Joe Donahue Posted January 25, 2024 Posted January 25, 2024 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
Members Sterio, Louis Posted January 25, 2024 Members Posted January 25, 2024 Hi there joe can you enable logging and provide the full XML request that the SDK is sending? How to enable logging
Members Sterio, Louis Posted January 25, 2024 Members Posted January 25, 2024 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>
Joe Donahue Posted January 26, 2024 Author Posted January 26, 2024 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
Members Sterio, Louis Posted January 26, 2024 Members Posted January 26, 2024 Joe, Email me directly with the company ID you're executing this against. I will check the logs and see if I can pull the request for you.
Members Sterio, Louis Posted January 27, 2024 Members Posted January 27, 2024 Joe, When you have a moment please confirm if you're all set now.
Joe Donahue Posted January 29, 2024 Author Posted January 29, 2024 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]
Members Sterio, Louis Posted January 31, 2024 Members Posted January 31, 2024 I will get in your demo company, test and get back to you.
Members Sterio, Louis Posted February 1, 2024 Members Posted February 1, 2024 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> 1
Joe Donahue Posted February 1, 2024 Author Posted February 1, 2024 Not sure what you hit with the smart rules, but I moved the ref id line and it went through without error. Wouldn't have thought to try that! Great catch and thank you very much! 1
Recommended Posts