cancel
Showing results for 
Search instead for 
Did you mean: 

Update OITM

fbio_bilicki
Active Contributor
0 Kudos

Hi,

Does anyone have a simple example in C # for me to update a field of OITM using SDK (Example OITM->ItemName)?

I can connect and read the data using the SDK samples, just can not update fields

Regards

Fabio.

Accepted Solutions (1)

Accepted Solutions (1)

edy_simon
Active Contributor
0 Kudos

Hi Fabio,

Simply put the properties you want to change and call the Update() method.

            oItem.GetByKey("ItemCode");  

            oItem.ItemName = "Changed Item Name";

            int lErr = oItem.Update();

Note that some properties are read only, and some properties cannot be changed after that specific Item is used in transactions.

Check the lErr for the result, when 0 = Successful update.

Regards

Edy

fbio_bilicki
Active Contributor
0 Kudos

Thank's, worked perfectly

Answers (1)

Answers (1)

Johan_H
Active Contributor
0 Kudos

Hi Fabio,

In addition to what Edy said, for any user fields you will need the following

oItem.UserFields.Fields.Item("U_YourUserFieldName").Value = oValue

where oValue has to be the correct data type and the name of your user field needs to be written correctly including small and capital letters.

Regards,

Johan

fbio_bilicki
Active Contributor
0 Kudos

Thank's, worked perfectly.