I'm using c# with the soap API. I have no issue with it creating the adjustment for the main charge. However, when I try to create it for the Tax amount I get the error code: "UNKNOWN_ERROR" with the message: "\"Operation failed due to an unknown error.\"" Any input is appreciated. I've pasted my code below. I used the creation example at the bottom of this link as my frame of reference. https://knowledgecenter.zuora.com/DC_Developers/SOAP_API/E1_SOAP_API_Object_Reference/InvoiceItemAdjustment List<InvoiceItemAdjustment> createThese = new List<InvoiceItemAdjustment>(); string qry = "SELECT Id, ChargeAmount, InvoiceId, TaxAmount FROM InvoiceItem WHERE InvoiceId = '" + invoiceId + "'"; result = Zuora.Query(qry); //cast the zobject result to an InvoiceItem List<InvoiceItem> invoiceItem = result.Objects.Cast<InvoiceItem>().ToList(); String adjType; //Create the new adjustments based on the amount and Id from the returned query //ForEach Begin invoiceItem.ForEach(r => { //Part one, create the adjustment for the main charge //Set the adjustment type depending on if its negative or positive amount if (r.ChargeAmount >= 0) { adjType = "Credit"; } else { adjType = "Charge"; } //Create the InvoiceItemAdjustment object InvoiceItemAdjustment itemAdj = new InvoiceItemAdjustment() { AdjustmentDate = DateTime.Now, AdjustmentDateSpecified = true, Amount = r.ChargeAmount, AmountSpecified = true, InvoiceId = r.InvoiceId, SourceId = r.Id, SourceType = "InvoiceDetail", Type = adjType, }; //add it to the list to create createThese.Add(itemAdj); //Part two, Create an object to adjust the tax //Set the adjustment type depending on if its negative or positive amount if (r.TaxAmount != 0) { if (r.TaxAmount >= 0) { adjType = "Credit"; } else { adjType = "Charge"; } //Create the InvoiceItemAdjustment object with the tax amount InvoiceItemAdjustment itemAdj2 = new InvoiceItemAdjustment() { AdjustmentDate = DateTime.Now, AdjustmentDateSpecified = true, Amount = r.TaxAmount, AmountSpecified = true, InvoiceId = r.InvoiceId, SourceId = r.Id, SourceType = "Tax", Type = adjType, }; //add the object to the list to create createThese.Add(itemAdj2); } //Foreach End }); //Loop through to create each adjustment createThese.ForEach(r => { ResponseHolder result2 = Zuora.Create(r); if(result2.Success == true) { Log("Success creating adjustment"); } else { Log("Failed to create the adjustment. Message: " + result2.Message); } });
... View more