Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    SmartGWT 14.1 Audit Change Time is null

    We upgraded from Enterprise 13.1-p20250107 to 14.1-p20251203 and now we're getting null values in the audit_changeTime field.

    Was there a change in 14.1 on how this works? Or is this a bug?

    #2
    We've tested this scenario and audit_changeTime is being populated correctly in 14.1. A few things to check in your configuration:

    1. Custom auditTimestampFieldName configuration
    If you've set auditTimestampFieldName to an empty string or a non-standard value in your DataSource, the framework won't know where to write the timestamp. Check your DS definition for any explicit audit field name overrides.

    2. Field name collision in your audited DataSource
    If your main DataSource already has a field named audit_changeTime (or whatever your configured timestamp field name is), this creates a collision. The audit DS inherits fields from the main DS, and having a pre-existing field with the same name can cause unexpected behavior. Rename any conflicting fields or use auditTimestampFieldName to specify a different audit field name.

    Could you post your DataSource definition (specifically the audit-related attributes and any fields starting with audit_)?

    Comment


      #3
      This was working fine in 13.0 and 13.1, only change we made was 14.1.

      We haven't done any customization at all with auditTimestampFieldName. We took an existing SQL datasource and just added audit="true", everything else is default.

      Here's the DS:

      Code:
      <DataSource ID="Customer"
                  serverType="sql"
                  tableName="customer"
                  audit="true">
          <serverObject lookupStyle="spring" bean="customerService"/>
          <fields>
              <field name="customer_id" type="sequence" hidden="true" primaryKey="true"/>
      
              <field name="parent_customer_id" type="integer" hidden="true" foreignKey="Customer.customer_id" joinType="outer"/>
              <field name="parentCustomerName" type="text" length="100" includeFrom="Customer.name"/>
      
              <!-- Other application-specific fields removed for brevity, nothing to do with any "audit" field -->
      
              <field name="created_by" type="creator" hidden="true"/>
              <field name="created_time" type="creatorTimestamp" hidden="true"/>
              <field name="modified_by" type="modifier" hidden="true"/>
              <field name="modified_time" type="modifierTimestamp" hidden="true"/>
      
              <field name="attachments" type="integer" title="Attachments"
                     customSelectExpression="(SELECT COUNT(*) FROM customer_attachment CA WHERE CA.customer_id = customer.customer_id)"/>
              <field name="_canRemove" type="boolean" sqlStorageStrategy="integer" customSelectExpression="(customer.instance_id IS NULL)"/>
              <field name="canExpand" type="boolean" sqlStorageStrategy="integer"
                     customSelectExpression="(SELECT COUNT(*) > 0 FROM customer C WHERE C.parent_customer_id = customer.customer_id)"/>
          </fields>
      
          <operationBindings>
              <operationBinding operationType="add" operationId="addGeneric" serverMethod="addGeneric"/>
              <operationBinding operationType="update" operationId="updateGeneric" serverMethod="updateGeneric"/>
              <operationBinding operationType="remove" serverMethod="delete"/>
          </operationBindings>
      </DataSource>
      We're don't have a defined audit datasource, just the default. We're loading the datasource in our bootstrap file like:

      Code:
      <script src="admin/sc/DataSourceLoader?dataSource=Customer,audit_Customer"></script>

      Comment


        #4
        We've triple-checked that, in the stock SQLDataSource path, the change time field is definitely generated and populated (and we've even added some more automated tests to fully verify it).

        The only way we can see this happening is if there's an audit_customer.ds.xml on disk which lacks the fields automatically generated by the audit system. If that were the case, then there is indeed a 13.1 -> 14.x change which would cause the field to be stripped.

        Do you either have such a file, or maybe you have a dynamicDSGenerator that's being invoked here?

        One way to check what's going on: just look at the fields on the audit DataSource. If the field for storing the change time is missing, that's definitely the problem, then it's just a matter of figuring out why that field is missing.

        Comment


          #5
          I grabbed a log of the SQL query, the field is there but it's setting NULL for the value:

          Code:
          2026-01-07 13:04:06.459 user=austin.derosso INFO com.isomorphic.SQL: - 695e59c60000000062eb826c7ea54b74 4451454101384476477 - Executing SQL query on 'Mysql': INSERT INTO audit_Customer (api_access, audit_changeTime, audit_modifier, audit_operationType, created_by, created_time, customer_id, modified_by, modified_time, name, prehung_access, supergrid_access, titan, v8, audit_revision) VALUES (0, NULL, 'austin.derosso', 'remove', 'austin.derosso', '2026-01-07 13:04:06', 1877, 'austin.derosso', NULL, 'Austin Test', 0, 0, 0, 0, NULL)
          I checked, there isn't an audit ds.xml file on disk, I've never created one. I've always relied on the one generated by setting audit="true".

          I also verified that the datasource does have that field. This is the response from DataSourceLoader?dataSource=Customer,audit_Customer:

          Code:
          if (window.isc == undefined || window.isc.DataSource == undefined) {
              alert("Can't load DataSources - SmartClient runtime not loaded");
          }
          isc.DataSource.create({
              allowAdvancedCriteria: true,
              tableCode: "91ec1f9324753048c0096d036a694f86",
              audit: true,
              serverType: "sql",
              operationBindings: [{
                  operationId: "addGeneric",
                  operationType: "add"
              }, {
                  operationId: "updateGeneric",
                  operationType: "update"
              }, {
                  operationType: "remove"
              }],
              isServerDS: true,
              ID: "Customer",
              fields: [{
                  name: "customer_id",
                  columnCode: "cb24373bb88538168c8e839069491f18",
                  hidden: true,
                  type: "sequence",
                  validators: [],
                  primaryKey: true
              },
          // Extra fields omitted for brevity
           {
                  name: "created_by",
                  columnCode: "dad46b2058752ffde5eaf02f1eb6abd5",
                  hidden: true,
                  type: "creator",
                  validators: [],
                  canEdit: false
              }, {
                  name: "created_time",
                  columnCode: "bb5855f0349346ae0b19eb381f00ab70",
                  hidden: true,
                  type: "creatorTimestamp",
                  validators: [],
                  canEdit: false
              }, {
                  name: "modified_by",
                  columnCode: "d6c05cd89c7b36759b8c0ee6c10204b8",
                  hidden: true,
                  type: "modifier",
                  validators: [],
                  canEdit: false
              }, {
                  name: "modified_time",
                  columnCode: "4f819a0bfbc6f5a469f90793d412b0dc",
                  hidden: true,
                  type: "modifierTimestamp",
                  validators: [],
                  canEdit: false
              }, {
                  name: "attachments",
                  columnCode: "da2fd5324f611f2b1d8b4fef9ae3179e",
                  title: "Attachments",
                  type: "integer",
                  validators: []
              }, {
                  name: "_canRemove",
                  columnCode: "fc2f922f392ee6f0220a76aa10311bdd",
                  type: "boolean",
                  validators: []
              }, {
                  name: "canExpand",
                  columnCode: "e1da00cb3f3bb37cff93cc5dd32d40bb",
                  type: "boolean",
                  validators: []
              }]
          })
          isc.DataSource.create({
              inheritsFrom: "Customer",
              xmlFromConfig: true,
              serverType: "sql",
              allowAdvancedCriteria: true,
              auditedDataSourceID: "Customer",
              tableCode: "fa16513215ebb68a74b6c36c7b8493d7",
              ID: "audit_Customer",
              fields: [{
                  name: "audit_revision",
                  columnCode: "97b2b566eb58b2e6ce61cf45722c3a86",
                  type: "sequence",
                  validators: [],
                  primaryKey: true
              }, {
                  name: "audit_operationType",
                  valueMap: ["add", "remove", "update"],
                  columnCode: "eb1c45a226c0403103e7def218eacc8a",
                  type: "enum",
                  validators: []
              }, {
                  hidden: false,
                  validators: [],
                  canEdit: false,
                  name: "audit_changeTime",
                  columnCode: "c4fa43e960790ba201b277e865c55e43",
                  type: "creatorTimestamp",
                  storeMilliseconds: true
              }, {
                  name: "audit_modifier",
                  columnCode: "17f12762117596fb13cfa1d7b6c72fad",
                  hidden: false,
                  type: "creator",
                  validators: [],
                  canEdit: false
              }, {
                  hidden: true,
                  validators: [],
                  multipleStorage: "simpleString",
                  length: 255,
                  multiple: true,
                  name: "audit_changedFields",
                  columnCode: "b0b2f4ce96d3911eabb5f6f0ed48d0de",
                  type: "text"
              }, {
                  name: "customer_id",
                  columnCode: "cb24373bb88538168c8e839069491f18",
                  hidden: true,
                  type: "integer",
                  validators: [],
                  primaryKey: false
              }, {
                  length: 100,
                  name: "name",
                  columnCode: "b068931cc450442b63f5b3d276ea4297",
                  type: "text",
                  required: false,
                  validators: []
              }]
          })

          Comment

          Working...
          X