diff --git a/pom.xml b/pom.xml
index 56d0df5c..acf3d96c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@
io.cdap.plugin
servicenow-plugins
- 1.2.5-SNAPSHOT
+ 1.2.5
ServiceNow Plugins
jar
Plugins for ServiceNow
diff --git a/src/main/java/io/cdap/plugin/servicenow/apiclient/ServiceNowTableAPIClientImpl.java b/src/main/java/io/cdap/plugin/servicenow/apiclient/ServiceNowTableAPIClientImpl.java
index 3c0afaa1..155aaccd 100644
--- a/src/main/java/io/cdap/plugin/servicenow/apiclient/ServiceNowTableAPIClientImpl.java
+++ b/src/main/java/io/cdap/plugin/servicenow/apiclient/ServiceNowTableAPIClientImpl.java
@@ -68,6 +68,8 @@ public class ServiceNowTableAPIClientImpl extends RestAPIClient {
private static final String FIELD_CREATED_ON = "sys_created_on";
private static final String FIELD_UPDATED_ON = "sys_updated_on";
private static final String OAUTH_URL_TEMPLATE = "%s/oauth_token.do";
+ private static final String GLIDE_TIME_DATATYPE = "glide_time";
+ private static final String GLIDE_DATE_TIME_DATATYPE = "glide_date_time";
private static final Gson GSON = new Gson();
private final ServiceNowConnectorConfig conf;
public static JsonArray serviceNowJsonResultArray;
@@ -309,6 +311,9 @@ public Schema fetchTableSchema(String tableName, String accessToken, SourceValue
if (valueType.equals(SourceValueType.SHOW_DISPLAY_VALUE) &&
!Objects.equals(field.getType(), field.getInternalType())) {
columns.add(new ServiceNowColumn(field.getName(), field.getType()));
+ } else if (valueType.equals(SourceValueType.SHOW_ACTUAL_VALUE) &&
+ GLIDE_TIME_DATATYPE.equalsIgnoreCase(field.getInternalType())) {
+ columns.add(new ServiceNowColumn(field.getName(), GLIDE_DATE_TIME_DATATYPE));
} else {
columns.add(new ServiceNowColumn(field.getName(), field.getInternalType()));
}
diff --git a/src/test/java/io/cdap/plugin/servicenow/apiclient/ServiceNowTableAPIClientImplTest.java b/src/test/java/io/cdap/plugin/servicenow/apiclient/ServiceNowTableAPIClientImplTest.java
index 8382c0a4..5298e7f2 100644
--- a/src/test/java/io/cdap/plugin/servicenow/apiclient/ServiceNowTableAPIClientImplTest.java
+++ b/src/test/java/io/cdap/plugin/servicenow/apiclient/ServiceNowTableAPIClientImplTest.java
@@ -117,6 +117,42 @@ public void testFetchTableSchema_ActualValueType() throws Exception {
schema.getField("user_name").getSchema().getUnionSchemas().get(0).getType());
}
+ @Test
+ public void testFetchTableSchema_GlideTimeFieldWithActualValueType() throws Exception {
+ ServiceNowConnectorConfig mockConfig = Mockito.mock(ServiceNowConnectorConfig.class);
+ ServiceNowTableAPIClientImpl impl = new ServiceNowTableAPIClientImpl(mockConfig);
+ ServiceNowTableAPIClientImpl implSpy = Mockito.spy(impl);
+
+ String jsonResponse = "{\n" +
+ " \"result\": {\n" +
+ " \"columns\": {\n" +
+ " \"u_start_time\": {\n" +
+ " \"label\": \"Start Time\",\n" +
+ " \"name\": \"u_start_time\",\n" +
+ " \"type\": \"string\",\n" +
+ " \"internal_type\": \"glide_time\"\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
+ "}";
+
+ RestAPIResponse mockResponse = new RestAPIResponse(Collections.emptyMap(), jsonResponse, null);
+ Mockito.doReturn(mockResponse).when(implSpy).executeGetWithRetries(Mockito.any());
+
+ Schema schema = implSpy.fetchTableSchema("u_custom_table", "dummy-access-token",
+ SourceValueType.SHOW_ACTUAL_VALUE);
+
+ Assert.assertNotNull(schema);
+ Assert.assertEquals("record", schema.getDisplayName());
+ Assert.assertEquals(1, schema.getFields().size());
+
+ Schema.Field field = schema.getField("u_start_time");
+ Assert.assertNotNull(field);
+
+ Schema fieldSchema = field.getSchema().getUnionSchemas().get(0);
+ Assert.assertEquals(Schema.LogicalType.DATETIME, fieldSchema.getLogicalType());
+ }
+
@Test
public void testFetchTableSchema_DisplayValueType() throws Exception {
ServiceNowConnectorConfig mockConfig = Mockito.mock(ServiceNowConnectorConfig.class);