When sending a filter to the webservice in php everything works fine, but when we need to sort on dates we encountered a problem. We need to get all the objects modified after a certain date.
In a page we have a date element, like so:
<xsd:element minOccurs="0" maxOccurs="1" name="Last_Date_Modified" type="xsd:date"/>
And we have tried the solution explained here on SO:
Dynamics Nav (Navision) webservice ReadMultiple date filter
But our date format is a bit different, ours looks like: 2013-01-01
In our filter, we have tried the following:
array(
'Field' => 'Last_Date_Modified',
'Criteria' => '20130101..'
)
And some other variations, but it doesn't return anything. If we leave it blank it returns everything. Does anyone have an idea as to what we can do? Would it help if we somehow stored the last_modified_date as a bigint like a unix timestamp?
I've tested similar setup with SOAPui and here is what I've got:
Outgoing message:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:obj="urn:microsoft-dynamics-schemas/page/objlist">
<soapenv:Header/>
<soapenv:Body>
<obj:ReadMultiple>
<obj:filter>
<obj:Field>Date</obj:Field>
<obj:Criteria>>=01012013</obj:Criteria>
</obj:filter>
<obj:bookmarkKey></obj:bookmarkKey>
<obj:setSize></obj:setSize>
</obj:ReadMultiple>
</soapenv:Body>
</soapenv:Envelope>
It results in correct response (with 3 records I have in my base changed since January)
Also response is correct if I put 01012013..
or 01.01.2013..
or even 01/01/2013..
but error will be returned in response for 20130101..
In response this field have value like this <Date>2013-05-15</Date>
which is incorrect format for my location though.
So your Nav server is waiting some other date format in your requests. Check Nav Server's CustomSettings.config
file to see if it has <add key="ServicesCultureDefaultUserPersonalization" value="true"/>
key. If you set it to "false" server will work in en-us date and number format.
Also check User Personalization
table in Nav. If previous key set to true then Nav will try to use language settings defined for user in this table.
If nothing helps try SOAPui to find out if Nav response correct to direct message (see format above or feed soapui with your wsdl file).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With