Hi, I get NullReference Exception when calling this submethod: SetOrderField(order, "Ordernumber", orderNo); SetOrderField(order, "TransferDate", DateTime.Now.Date);
order.Save(order.ID); The same applies to setting product fields. Here is the submethod: private static void SetOrderField(Order order, string fieldName, object value) { if (order.OrderFieldValues == null) { order.OrderFieldValues = new OrderFieldValueCollection(); } OrderFieldValue fieldValue = order.OrderFieldValues.GetOrderFieldValue(fieldName); OrderField newField = null; if (fieldValue == null) { fieldValue = new OrderFieldValue(); foreach (OrderField field in OrderField.getOrderFields()) { if (field.Name == fieldName) { newField = field; break; } } } fieldValue.OrderField = newField; order.OrderFieldValues.Add(fieldValue); fieldValue.Value = value; }
Per