Hi,
I am new to SAP B1 SDK and I have been trying to insert record into an UDT of document type. I retrieve the Purchase Order number in the edit text field using Choose From List which works fine.
But I get 'Invalid Field Name' when adding the record. I debugged the code and it shows the error at this code piece,
oUserTable = oCompany.UserTables.Item("TEST"); // Debug line- 'Invalid Field Name'
Here's my full code and image of the udf:
public Company oCompany; public UserTable oUserTable; private void Button0_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent) { BubbleEvent = true; oCompany = new Company(); oUserTable = null; oUserTable = oCompany.UserTables.Item("TEST"); // Debug line- 'Invalid Field Name' oUserTable.Code = Convert.ToString(1); oUserTable.UserFields.Fields.Item("U_PONo").Value = EditText0.Value; oUserTable.Add(); oUserTable = null; GC.Collect(); }