Add Method (SO)
- Last UpdatedNov 06, 2025
- 3 minute read
The Add() method adds a new sales order record to the SO table.
The sales order is uniquely identified by the combination of the customer ID and purchase order ID in the sales order record.
'Declaration
Public Shared Sub Add( _
ByVal sessionId As Integer, _
ByVal custId As String, _
ByVal poId As String, _
ByVal dateReceivedLocal As Date, _
ByVal purchaserId As Nullable(Of Integer), _
ByVal shipFrom As Nullable(Of Integer), _
ByVal soId As String, _
ByVal stateCode As Nullable(Of SalesOrderState), _
ByVal notes As String, _
ByVal spare1 As String, _
ByVal spare2 As String, _
ByVal spare3 As String, _
ByVal spare4 As String, _
ByVal lastEditComment As String, _
ByRef modId As String _
)
'Usage
Dim sessionId As Integer
Dim custId As String
Dim poId As String
Dim dateReceivedLocal As Date
Dim purchaserId As Nullable(Of Integer)
Dim shipFrom As Nullable(Of Integer)
Dim soId As String
Dim stateCode As Nullable(Of SalesOrderState)
Dim notes As String
Dim spare1 As String
Dim spare2 As String
Dim spare3 As String
Dim spare4 As String
Dim lastEditComment As String
Dim modId As String
SO.Add(sessionId, custId, poId, dateReceivedLocal, purchaserId, shipFrom, soId, stateCode, notes, spare1, spare2, spare3, spare4, lastEditComment, modId)
public static void Add(
int sessionId,
string custId,
string poId,
DateTime dateReceivedLocal,
Nullable<int> purchaserId,
Nullable<int> shipFrom,
string soId,
Nullable<SalesOrderState> stateCode,
string notes,
string spare1,
string spare2,
string spare3,
string spare4,
string lastEditComment,
out string modId
)
Parameters
- sessionId
- Required. Holds the session ID and thus the user who is making this method call.
- custId
- Required. Holds the customer ID.
- poId
- Required. Holds the ID of the customer's purchase order.
- dateReceivedLocal
- Required. Holds the date that the sales order was received in the local time of the entity specified by the shipFrom parameter, if supplied. If a ship-from entity is not specified, the default time zone will be used to determine the local time.
- purchaserId
- Optional. Holds the contact ID of the purchaser. This parameter can be used with the custId parameter to find the contact information in the Cust_Contact table.
- shipFrom
- Optional. Holds the ID of the entity from which the sales order is expected to ship.
- soId
- Optional. Holds the ID of the internal sales order, if any.
- stateCode
Optional. Holds a SalesOrderState enumeration value that indicates the state of the sales order:
0=Open (the default)
1=Partially Complete
2=Closed
- notes
- Optional. Holds notes about the sales order.
- spare1
- Optional. Holds the contents of the user-defined spare1 field.
- spare2
- Optional. Holds the contents of the user-defined spare2 field.
- spare3
- Optional. Holds the contents of the user-defined spare3 field.
- spare4
- Optional. Holds the contents of the user-defined spare4 field.
- lastEditComment
- Optional. Holds comments that describe why this record is being added.
- modId
- Output. Holds the modification ID assigned to this record when it is added. The modId parameter is used by other methods that modify or delete this type of record for optimistic concurrency control.
Observe the following input parameter rules:
- Required non-DB* parameters: Must pass a value. Cannot be empty or null.
- Optional non-DB* parameters: Either enter a value or pass a null. If passing a null and a default value has been defined, the default value will be used for the parameter.
- Required DB* parameters: Must pass a value. To enter an empty value for the parameter, pass DB*.null (e.g., DBInt.null).
- Optional DB* parameters: To enter no value for the parameter, pass DB*.null (e.g., DBInt.null). To use the default value for the parameter if one has been defined for the object being added, pass a null.