You need to sign in to do that
Don't have an account?
![tssupport tssupport](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
Using a DateTime in filter query
I'm trying to use a DateTime in a filter query. When I try to execute the query I get the following exception:
The server returned the following fault information:
Fault Code: 1003
Fault string: null parameter
What am I doing wrong? Using filters with other fields is no problem, just datetime fields.
The code I'm using follows below (C#, SOAP API).
public bool testDateTime(){
Logon();
object[] ret;
DateTime lastTime = DateTime.Now.AddDays(-2);
object[] filter = new object[] {
MakeSimpleFilter(
"lastModifiedDate",
lastTime,
"greater than"
)
};
string[] selectList = new string[]{
"id",
"name",
"lastModifiedDate"
};
try{
ret = (object[]) sForce.query("opportunity", 20, true, selectList, filter);
}catch (SoapHeaderException ex) {
//This is typical error handling for fault detection and reporting, the .Net Proxy client actually throws an
//error rather than return the fault SOAP Message.
Trace.WriteLine("The server returned the following fault information:");
Trace.WriteLine("Fault Code: " + ((XmlQualifiedName) ((SoapException)ex).Code).Name);
Trace.WriteLine("Fault string: " + ex.Message);
return false;
}
//Parsing of reply
return true;
}
regards
Daniel
Ki Consulting