What is the best way to pull CustomerShipToTaxExemptions from Sage 100 using C#? Below is my code to create a session and pull the dispatch object using ui and bus but it throws this error- **** From ProvideX: Lookup program failed. The task id "000000000" is not on file.
Code-
DispatchObject oObject = null;
string date = DateTime.Now.ToString("yyyyMMdd");
pvx = new DispatchObject("ProvideX.Script");
pvx.InvokeMethod("Init", path);
oSS = new DispatchObject(pvx.InvokeMethod("NewObject", "SY_Session"));
RetCheck(Convert.ToInt32(oSS.InvokeMethod("nLogon")), oSS);
RetCheck(Convert.ToInt32(oSS.InvokeMethod("nSetUser", userName, pass)), oSS);
RetCheck(Convert.ToInt32(oSS.InvokeMethod("nSetCompany", company)), oSS);
RetCheck(Convert.ToInt32(oSS.InvokeMethod("nSetDate", module, date)), oSS);
RetCheck(Convert.ToInt32(oSS.InvokeMethod("nSetModule", module)), oSS);
int taskID = Convert.ToInt32(oSS.InvokeMethod("nLookupTask", "AR_CustomerShipToTaxExemptions_ui"));
RetCheck(Convert.ToInt32(oSS.InvokeMethod("nSetProgram", taskID)), oSS);
oObject = new DispatchObject(pvx.InvokeMethod("NewObject", "AR_CustomerShipToTaxExemptions_bus", oSS.GetObject()));
return oObject;