Error while creating sales order BOI -"The Creation Date is required.ŠThe Creation Time is required.Š"

SUGGESTED

public ResponseModel CreateSO(SalesOrderModel salesOrderModel) { using (SageDispatcher pvx = new SageDispatcher("ProvideX.Script")) { // Replace the text "*PATH TO MAS90\HOME*" with the correct MAS90\Home path in the line below pvx.InvokeMethod("Init", mas90); // Instantiate a new Session object and initialize the session // by setting the user, company, date and module SageDispatcher oSS = new SageDispatcher(pvx.InvokeMethod("NewObject", "SY_Session")); { oSS.InvokeMethod("nLogon"); oSS.InvokeMethod("nSetUser", new object[] { "vivek", "welcome@123" }); oSS.InvokeMethod("nSetCompany", compCode); oSS.InvokeMethod("nSetDate", "S/O", accDate); oSS.InvokeMethod("nSetModule", "S/O"); // Get the Task ID for the AR_Customer_ui program int TaskID = (int) oSS.InvokeMethod("nLookupTask", "SO_SalesOrder_ui"); oSS.InvokeMethod("nSetProgram", TaskID); SageDispatcher so_order = new SageDispatcher(pvx.InvokeMethod("NewObject", "SO_SalesOrder_bus", oSS.GetObject())); { string strSalesOrderNo = ""; object[] arrResults = new object[] { strSalesOrderNo }; retVal = so_order.InvokeMethodByRef("nGetNextSalesOrderNo", arrResults); strSalesOrderNo = arrResults[0].ToString(); successCheck((int) so_order.InvokeMethod("nSetKey", strSalesOrderNo), "SetKey"); int retval = (int) so_order.InvokeMethod("nFind", strSalesOrderNo); // Add items to the header successCheck((int) so_order.InvokeMethod("nSetValue", "ARDivisionNo$", "00"), "SetValue"); retVal = so_order.InvokeMethod("nSetValue", "CustomerNo$", "WEB999"); retVal = so_order.InvokeMethod("nSetValue", "CustomerNo$", salesOrderModel.CustomerNo); retVal = so_order.InvokeMethod("nSetValue", "TaxSchedule$", "D

using (SageDispatcher pvx = new SageDispatcher("ProvideX.Script"))
{

// Replace the text "*PATH TO MAS90\HOME*" with the correct MAS90\Home path in the line below
pvx.InvokeMethod("Init", mas90);

// Instantiate a new Session object and initialize the session
// by setting the user, company, date and module
SageDispatcher oSS = new SageDispatcher(pvx.InvokeMethod("NewObject", "SY_Session"));
{
oSS.InvokeMethod("nLogon");
oSS.InvokeMethod("nSetUser", new object[] { "vivek", "welcome@123" });
oSS.InvokeMethod("nSetCompany", compCode);
oSS.InvokeMethod("nSetDate", "S/O", accDate);
oSS.InvokeMethod("nSetModule", "S/O");

// Get the Task ID for the AR_Customer_ui program
int TaskID = (int) oSS.InvokeMethod("nLookupTask", "SO_SalesOrder_ui");
oSS.InvokeMethod("nSetProgram", TaskID);


SageDispatcher so_order = new SageDispatcher(pvx.InvokeMethod("NewObject", "SO_SalesOrder_bus", oSS.GetObject()));
{
string strSalesOrderNo = "";
object[] arrResults = new object[] { strSalesOrderNo };
retVal = so_order.InvokeMethodByRef("nGetNextSalesOrderNo", arrResults);
strSalesOrderNo = arrResults[0].ToString();

successCheck((int) so_order.InvokeMethod("nSetKey", strSalesOrderNo), "SetKey");

int retval = (int) so_order.InvokeMethod("nFind", strSalesOrderNo);

// Add items to the header


successCheck((int) so_order.InvokeMethod("nSetValue", "ARDivisionNo$", "00"), "SetValue");
retVal = so_order.InvokeMethod("nSetValue", "CustomerNo$", "WEB999");

retVal = so_order.InvokeMethod("nSetValue", "CustomerNo$", salesOrderModel.CustomerNo);

retVal = so_order.InvokeMethod("nSetValue", "TaxSchedule$", "DEFAULT");
retVal = so_order.InvokeMethod("nSetValue", "OrderType$", "S");
retVal = so_order.InvokeMethod("nSetValue", "OrderDate$", salesOrderModel.OrderDate.ToString("yyyyMMdd"));


//successCheck((int) so_order.InvokeMethod("nSetValue", "ARDivisionNo$", "00"), "SetValue");
//retVal = so_order.InvokeMethod("nSetValue", "CustomerNo$", salesOrderModel.CustomerNo);
//retVal = so_order.InvokeMethod("nSetValue", "TaxSchedule$", salesOrderModel.TaxSchedule);
//retVal = so_order.InvokeMethod("nSetValue", "OrderType$", salesOrderModel.OrderType);
//retVal = so_order.InvokeMethod("nSetValue", "CustomerPONo$", salesOrderModel.PurchaseOrderNumber);
////successCheck((int) so_order.InvokeMethod("nSetValue", "OrderDate$", DateTime.Now.ToString("yyyyMMdd")), "SetValue");

////bill to
//retVal = so_order.InvokeMethod("nSetValue", "BillToName$", salesOrderModel.BillAddressLines.Name);
//retVal = so_order.InvokeMethod("nSetValue", "BillToAddress1$", salesOrderModel.BillAddressLines.Address1);
//retVal = so_order.InvokeMethod("nSetValue", "BillToCity$", salesOrderModel.BillAddressLines.City);
//retVal = so_order.InvokeMethod("nSetValue", "BillToState$", salesOrderModel.BillAddressLines.State);
//retVal = so_order.InvokeMethod("nSetValue", "BillToZipCode$", salesOrderModel.BillAddressLines.ZipCode);
//retVal = so_order.InvokeMethod("nSetValue", "BillToCountryCode$", salesOrderModel.BillAddressLines.CountryCode);

////Shipto
//retVal = so_order.InvokeMethod("nSetValue", "ShipToName$", salesOrderModel.ShipAddressLines.Name);
//retVal = so_order.InvokeMethod("nSetValue", "ShipToAddress1$", salesOrderModel.ShipAddressLines.Address1);
//retVal = so_order.InvokeMethod("nSetValue", "ShipToCity$", salesOrderModel.ShipAddressLines.City);
//retVal = so_order.InvokeMethod("nSetValue", "ShipToState$", salesOrderModel.ShipAddressLines.State);
//retVal = so_order.InvokeMethod("nSetValue", "ShipToZipCode$", salesOrderModel.ShipAddressLines.ZipCode);
//retVal = so_order.InvokeMethod("nSetValue", "ShipToCountryCode$", salesOrderModel.ShipAddressLines.CountryCode);

// Add a line
retVal = so_order.InvokeMethod("nAddLine");

foreach (var line in salesOrderModel.Items)
{
using (SageDispatcher oLines = new SageDispatcher(so_order.GetProperty("oLines")))
{
retVal = oLines.InvokeMethod("nSetValue", "ItemCode$", "/801201");
retVal = oLines.InvokeMethod("nSetValue", "ItemCode$", string.Format("/{0}", line.ItemCode));
string error1 = (string) so_order.GetProperty("sLastErrorMsg");
retVal = oLines.InvokeMethod("nSetValue", "ItemType$", line.ItemType);
//retVal = oLines.InvokeMethod("nSetValue", "QuantityOrdered", "2.0");
retVal = oLines.InvokeMethod("nSetValue", "QuantityOrdered", line.Quantity);
//retVal = oLines.InvokeMethod("nSetValue", "WarehouseCode$", "000");
//retVal = oLines.InvokeMethod("nSetValue", "SalesAcct$", "320");
//retVal = oLines.InvokeMethod("nSetValue", "PriceLevel$", "R");

//string error = (string) oLines.GetProperty("sLastErrorMsg");
retVal = oLines.InvokeMethod("nWrite");
}
}
//Write the order
retVal = so_order.InvokeMethod("nWrite");
string error = (string) so_order.GetProperty("sLastErrorMsg");
}
}

EFAULT"); retVal = so_order.InvokeMethod("nSetValue", "OrderType$", "S"); retVal = so_order.InvokeMethod("nSetValue", "OrderDate$", salesOrderModel.OrderDate.ToString("yyyyMMdd")); // Add a line retVal = so_order.InvokeMethod("nAddLine"); foreach (var line in salesOrderModel.Items) { using (SageDispatcher oLines = new SageDispatcher(so_order.GetProperty("oLines"))) { retVal = oLines.InvokeMethod("nSetValue", "ItemCode$", "/801201"); retVal = oLines.InvokeMethod("nSetValue", "ItemCode$", string.Format("/{0}", line.ItemCode)); string error1 = (string) so_order.GetProperty("sLastErrorMsg"); retVal = oLines.InvokeMethod("nSetValue", "ItemType$", line.ItemType); retVal = oLines.InvokeMethod("nSetValue", "QuantityOrdered", line.Quantity); retVal = oLines.InvokeMethod("nWrite"); } } //Write the order retVal = so_order.InvokeMethod("nWrite"); string error = (string) so_order.GetProperty("sLastErrorMsg"); } }