| InfoToday Tools for Visual Rams |
| Creating New Records |
First you need to issue the "New" command on the appropriate object. For example say you want to create a new work order.
loITRDS.OWORKORDERS.New()
This will place a blank object in oData. All you need to do now is populate the fields with values as follows (note we check for errors after each "ADDFIELDVALUE" as errors may occur through trying to assign a value of the incorrect data type);
If not loITRDS.OWORKORDERS.AddFieldValue("account","2744262")
* Error
Endif
If not loITRDS.OWORKORDERS.AddFieldValue("wo_type","S")
* Error
Endif
If not loITRDS.OWORKORDERS.AddFieldValue("Level",1)
* Error
Endif
If Not loITRDS.OWORKORDERS.AddFieldValue("Department","OPS")
* Error
Endif
And then issue the save command
If not loITRDS.OWORKORDERS.Save()
* Access error message if you want
lcErrorMessage = loITRDS.OWORKORDERS.cErrorMsg
* Handle Error
Endif
Remember that a great deal of validation goes on when you save this data so it's very important to check for errors when saving data