Question

DateTime format in DataService

Hey folks,

   I have been trying to create a record using the DataService as specified here: https://academy.bpmonline.com/documents/technic-sdk/7-8/dataservice-add…

I have a DateTime column in the object I am trying to add, but in the documentation there is nothing saying regarding the format with which I should send the DateTime value to the service. I tried a lot of different known formats (yyyy-MM-dd HH:mm:ss, yyyy-MM-ddTHH:mm:ss, yyyy-MM-dd HH:mm, dd/MM/yyyy HH:mm:ss, yyyy-MM-ddTHH:mm:ss, and so on) but I always get the error message from server:

 {"success":false,"responseStatus":{"ErrorCode":"FormatException","Message":"Input string was not in a correct format.","Errors":[]},"rowsAffected":-1,"nextPrcElReady":false}

The json I am sending is as follows, currently using the format yyyy-MM-ddTHH:mm

{"RootSchemaName":"UsrStudents","ColumnValues":{"Items":{"UsrName":{"ExpressionType":2,"Parameter":{"DataValueType":1,"Value":"Suporte"}},"UsrEmail":{"ExpressionType":2,"Parameter":{"DataValueType":1,"Value":"suporte@vedantaonline.org"}},"UsrFederalInscriptionId":{"ExpressionType":2,"Parameter":{"DataValueType":1,"Value":null}},"UsrAddressLine1":{"ExpressionType":2,"Parameter":{"DataValueType":1,"Value":null}},"UsrAddressLine2":{"ExpressionType":2,"Parameter":{"DataValueType":1,"Value":null}},"UsrAddressCity":{"ExpressionType":2,"Parameter":{"DataValueType":1,"Value":null}},"UsrAddressCountry":{"ExpressionType":2,"Parameter":{"DataValueType":1,"Value":null}},"UsrAddressZipcode":{"ExpressionType":2,"Parameter":{"DataValueType":1,"Value":null}},"UsrPhone":{"ExpressionType":2,"Parameter":{"DataValueType":1,"Value":null}},"UsrCreationTimestamp":{"ExpressionType":2,"Parameter":{"DataValueType":7,"Value":"2016-03-11T11:01"}}}},"Filters":{"FilterType":6,"Items":{"FilterById":{"FilterType":1,"ComparisonType":3,"LeftExpression":{"ExpressionType":0,"Parameter":null,"ColumnPath":"Id"},"RightExpression":{"ExpressionType":2,"Parameter":{"DataValueType":1,"Value":"67b36b17-72ae-4bab-bdd3-eb3159f9150d"},"ColumnPath":null}}}}}

 

The problem happens when I try to set this field: "UsrCreationTimestamp":{"ExpressionType":2,"Parameter":{"DataValueType":7,"Value":"2016-03-11T11:01"}} which is DateTime

 

Best regards

Joao Cechin

Like 0

Like

2 comments

Dear Joao,

Please see the example below of the DateTime format to be used:

{dataValueType: 7, value: ""2017-11-23T16:00:00.000""}

This is November, 23rd, 2017. Time 4 pm or 16:00.

Hope you find it helpful.

Regards,

Anastasia

Anastasia Botezat,

Thank you very much Anastasia!!! I also got it to work sending in the format:

 

"\\/Date(1335205592410)\\/", where the number inside represents the quantity of miliseconds from 01/01/1970 till the date you want to add to the record.

Best Regards,

João

 

Show all comments