AR Write Off and Adjustment Posting

I am attempting to create a customization for AR Write Off and Adjustments such that a selected number of invoices can be processed at the same time vs individually. Below is the code written to create the Adjustment and set the required fields. The code follows the trace methods with the exception of the Update method at the end. Use of the standard form requires the user to Submit the Process to the Task Agent for posting. Referencing the Help file, it states:

  • A posting action is not necessary when adjusting or writing off an invoice; the GL updates once the adjustment saves

However, this may be outdated as the following error is received when running the code:

image

I have ran traces for both processes of using the standard form and running the code. The mehtod calls, datasets and responses are identical. The code completes sucessfully through the ValidateTransaction method, but fails during the Update method.

Lastly, I noticed the Erp.Contracts.Proc.ARInvAdjPost assembly was included when adding the reference to the ARAdjustment Adapter. I need an education on how to reference that assembly in the customization to gain access to its methods. Any suggestions, direction would be greatly appreciated.

TIA

private void WriteOffInvoice(int invoiceNum, double adjustAmt)
{
	try
	{
		string glCompany = "*****";
		string glChart = "*****";
		string glAccount = "*****";
		string glSegValue1 = "*****";
		string glSegValue2 = "*****";
		string glSegValue3 = "*****";
		string glSegValue4 = "*****";
		string adjComment = this.txtComment.Value.ToString();
		bool reload = false;
		using (ARAdjustmentAdapter AdjustmentAdapter = new ARAdjustmentAdapter(this.oTrans))
		{
			AdjustmentAdapter.BOConnect();
			AdjustmentAdapter.GetByID(invoiceNum);
			AdjustmentAdapter.GetNewCashDtl1(invoiceNum);
			DataRow cashDtlRow = AdjustmentAdapter.ARAdjustmentData.Tables["CashDtl"].Rows[0];
			cashDtlRow.BeginEdit();
				cashDtlRow["DocDispTranAmt"] = adjustAmt;
				cashDtlRow["DispTranAmt"] = adjustAmt;
				cashDtlRow["Reference"] = adjComment;
			cashDtlRow.EndEdit();
			AdjustmentAdapter.ChangeAdjAmount(out reload);
			DataRow cashDtlTGLCRow = AdjustmentAdapter.ARAdjustmentData.Tables["CashDtlTGLC"].Rows[0];
			cashDtlTGLCRow.BeginEdit();
				cashDtlTGLCRow["GLAccount"] = glAccount;
				cashDtlTGLCRow["SegValue1"] = glSegValue1;
				cashDtlTGLCRow["SegValue2"] = glSegValue2;
				cashDtlTGLCRow["SegValue3"] = glSegValue3;
				cashDtlTGLCRow["SegValue4"] = glSegValue4;
			cashDtlTGLCRow.EndEdit();
			AdjustmentAdapter.ChangeGLAcctDisp(glCompany, glChart, glAccount);
			AdjustmentAdapter.ValidateTransaction();
			AdjustmentAdapter.Update();
		}
	}
	catch (System.Exception ex)
	{
		ExceptionBox.Show(ex);
	}
}