Scripte REST API - GlideDateTime() returns error

george24
Kilo Contributor

Hi,

I have a Scripted REST API and I am trying to populate a table and create a ticket from it using data coming from OMS via webhook. I am trying to populate a dateTime record using new GlideDateTime() constructor but it is not working - I am receiving the following error:

Cannot map object: java.lang.RuntimeException: Cannot map object: com.glide.rest.serializer.impl.JSONSerializer.handleSerializeException(JSONSerializer.java:154)

com.glide.rest.serializer.impl.JSONSerializer.serializeServiceResult(JSONSerializer.java:59)

com.glide.rest.handler.impl.ServiceResultHandlerImpl.serialize(ServiceResultHandlerImpl.java:122)

com.glide.rest.handler.impl.ServiceResultHandlerImpl.processServiceResultBody(ServiceResultHandlerImpl.java:96)

com.glide.rest.handler.impl.ServiceResultHandlerImpl.processServiceResult(ServiceResultHandlerImpl.java:40)

com.glide.rest.processors.RESTAPIProcessor.process(RESTAPIProcessor.java:231)

com.glide.processors.AProcessor.runProcessor(AProcessor.java:412)

com.glide.processors.AProcessor.processTransaction(AProcessor.java:187)

com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:165)

com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:49)

com.glide.sys.ServletTransaction.run(ServletTransaction.java:34)

java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

java.lang.Thread.run(Thread.java:748)

What am I doing wrong? any help would be appreciated, thank you.

1 ACCEPTED SOLUTION

jxsaxton421
Tera Guru

Hi George, if you have a code snippet that would be helpful to solving your problem. GlideDateTime can only convert strings, so if it's not a string that might be the main problem. I haven't seen any code, so if your still looking that would be helpful.

View solution in original post

4 REPLIES 4

jxsaxton421
Tera Guru

Hi George, if you have a code snippet that would be helpful to solving your problem. GlideDateTime can only convert strings, so if it's not a string that might be the main problem. I haven't seen any code, so if your still looking that would be helpful.

Coleton
Kilo Guru

If you could post the script, we might be able to help. The error isn't much to go off of. I mean, the "cannot map object" means you're passing the wrong object/variable type into the designated field.

Yogish Naik1
Kilo Guru
new GlideDateTime('2018-12-31 00:00:00'); pass value in this format

george24
Kilo Contributor

hey guys, the question was asked a few months back and I don't remember what was the problem but I know it was solved. Appreciate your comments!