Announcement

Collapse
No announcement yet.

Null Date time field is populated by calculating the duration between fields

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Null Date time field is populated by calculating the duration between fields

    Hi,

    I have a custom object. I have a startTime and an endTime field that are used to calculate a duration field. I display all 3 fields on the list view. If startTime is populated but endTime is null, The endTime field is displaying the startTime value. In the form view the value starts out populated and then updates to be None.

    The JSON data does not have a value in the endTime field.

    Does anyone have any suggestions on how I can fix this or is it a bug? I am using version 6.1.7

    PHP Code:
    Response Data
    {
    "total":1,"list":[{"id":"61223059a567a3e69","name":"A","createdAt":" 2021-08-22 11:09:13","startTime":"2021-08-22 11:09:00","endTime":null,"duration":null,"createdB yId":"2","createdByName":"Mythradon Admin","assignedUserId":"2","parentId":"6044a4000c 590d9ba","parentType":"Account","parentName":"Fine Defective"}]}

    Entity Def:
            
    "startTime": {
                
    "notNull"false,
                
    "type""datetime",
                
    "required"true,
                
    "default""javascript: return this.dateTime.getNow(1);",
                
    "readOnly"true,
                
    "customizationDisabled"true
            
    },
            
    "endTime": {
                
    "type""datetimeOptional",
                
    "view""crm:views/task/fields/date-end",
                
    "readOnly"true,
                
    "customizationDisabled"true
            
    },
            
    "duration": {
                
    "type""duration",
                
    "start""startTime",
                
    "end""endTime",
                
    "options": [
                    
    300,
                    
    600,
                    
    900,
                    
    1800,
                    
    2700,
                    
    3600,
                    
    7200
                
    ],
                
    "notStorable"true,
                
    "select": {
                    
    "select""TIMESTAMPDIFF_SECOND:(startTime, endTime)"
                
    },
                
    "order": {
                    
    "order": [
                        [
                            
    "TIMESTAMPDIFF_SECOND:(startTime, endTime)",
                            
    "{direction}"
                        
    ]
                    ]
                }
            }, 



  • #2
    I have put a sample together. Here is a link to a zip of my custom dir: https://drive.google.com/file/d/1dfU...ew?usp=sharing

    Comment


    • #3
      The problem seems to be around the view and the way it calculates the value for the UI. I have changed the field to be a varchar and I am setting it on the server side in loadAdditionalFields to get around this issue.

      Comment

      Working...
      X