Showing results for 
Search instead for 
Did you mean: 

DI: updating user-defined fields

Former Member
0 Kudos

I'm developing a java application to create & update sales orders in B1.  I had planned on using user-defined fields to store cross-reference informatin when the sales order is created. This would allow me to process future updates. However, when I reviewed the DI API help, I discovered that user-defined fields are read-only. Is there a way to provide a value for a user-defined field when a business object (i.e. sales order) is created?



Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

The DI API help file Version 6.5 that I have states

"All of the properties, except ValidValue and Value, are read only."

Value is the property you need to use.  Using VB6.0 I can easily update user-defined fields on business objects when creating them. I haven't tried it in Java, but I would expect it to work the same.


   Dim sboItem As SAPbobsCOM.Items

   Set sboItem = sboCompany.GetBusinessObject(oItems)

   sboItem.ItemCode = "XXXX"

   sboItem.ItemName = "Description"

   sboItem.UserFields.Fields("U_HCode").Value = "H1"

   If (0 <> sboItem.Add()) Then

       MsgBox ("Failed to add item.")


       MsgBox ("Success - item added..")

   End If


Former Member
0 Kudos

Thanks for your reply.  The VB example certainly looks easy and straightforward, but I don't think I can access the properties directly in Java. Because of the property definition in the object (Documents), I'm limited to using get & set methods. The UserFields property has a get method, but no set method. My workaround was to stick the legacy reference in an unused field. I'm still learning Java so there may be a trick that I'm not aware of.

Thanks again for your help.