SuiteCRM 8.5.0 Case Status Not Saving

Issue
I’m finding that v8.5.0 (and 8.4.2) don’t save the case status when it’s updated in an edit on screen.

Expected Behavior
The case status should be saved into the DB when it’s selected by the user on screen.

Investigation
The CRM seems to retain the state, but not the status. I see that in the dropdown list editor, status is a hybrid value of state_status (ex: Open_Assigned). This is so that certain statuses are available subordinate to certain corresponding states.

In the DB, the state is stored independently in column state with a value of Open, and the status is stored as the hybrid construction in column status which should show Open_Assigned.

I was able to capture the save operation via the log (set level to Info). While I don’t see errors, I do see a SQL query which contains an offending value:

UPDATE cases SET 
`name`='PDI Test',
`date_modified`='2024-01-27 07:54:47',
`modified_user_id`='1',
`created_by`='ceab0b19-fa61-2373-9970-65838b281334',
`description`='Perform Pre-Delivery Procedures in Assigned Tasks',
`assigned_user_id`='ceab0b19-fa61-2373-9970-65838b281334',
`type`='pdi',
`status`=NULL,
`priority`='P1',
`resolution`=NULL,
`work_log`=NULL,
`account_id`='66a1efda-f817-25c1-2496-5e18dacab4c9',
`state`='Open',
`contact_created_by_id`=''
WHERE  cases.id = '4600f72c-56b6-6970-4dee-65b45c09db90' AND deleted=0

As you can see, the status=NULL value is incorrect, and is the obvious cause for the incorrect value to be submitted into the database.

Potential for Solutions
Where is this query constructed? Perhaps more importantly, is anyone familiar with the process by which the on-screen field value is captured and relayed into the query for DB submission?

System
SuiteCRM 8.5.0
BlueHost Linux 4.19.286-203.ELK.el7.x86_64 x86_64
Apache 2.4.58
MySQL 5.7.23-23
PHP 8.1 (Tried with 7.4 and 8.2 also)

I would suspect this is a front-end bug, because lately there’s been more work done on the front-end. And since it seems to be a corner-case, a “hybrid” field that’s saved as two separate fields, it makes sense that something might have been overlooked.

Can you try a quick test and check the browser tools, network tab, and see if you can find a network request happening when you select the dropdown. What is the content of that request?

If there’s nothing when selecting the dropdown, then at least when you click to save the record, what is in the request? Is it correct there?

As always, solid thought @pgr. A few graphql requests fire off, but this is the relevant one. The status value is not being captured from the UI. Is this something I can manipulate with your help? See the formatted request payload below.
(NOTE: References to Vehicles and Work Log are custom modules… hopefully not causing this…)

{
  "operationName": "saveRecord",
  "variables": {
    "input": {
      "module": "cases",
      "attributes": {
        "module_name": "Cases",
        "object_name": "Case",
        "id": "4600f72c-56b6-6970-4dee-65b45c09db90",
        "name": "PDI Test",
        "date_entered": "2024-01-27 01:27:59",
        "date_modified": "2024-01-27 17:40:33",
        "modified_user_id": "1",
        "modified_by_name": { "user_name": "Chris Tucker", "id": "1" },
        "created_by": "ceab0b19-fa61-2373-9970-65838b281334",
        "created_by_name": {
          "user_name": "REDACTED",
          "id": "ceab0b19-fa61-2373-9970-65838b281334"
        },
        "description": "Perform Pre-Delivery Procedures in Assigned Tasks",
        "deleted": "",
        "assigned_user_id": "ceab0b19-fa61-2373-9970-65838b281334",
        "assigned_user_name": {
          "user_name": "REDACTED",
          "id": "ceab0b19-fa61-2373-9970-65838b281334"
        },
        "case_number": "393",
        "type": "pdi",
        "status": "",
        "priority": "P1",
        "resolution": "",
        "work_log": "",
        "suggestion_box": "",
        "account_name": {
          "name": "REDACTED,
          "id": "66a1efda-f817-25c1-2496-5e18dacab4c9"
        },
        "account_name1": "",
        "account_id": "66a1efda-f817-25c1-2496-5e18dacab4c9",
        "state": "Open",
        "case_attachments_display": "",
        "case_update_form": "",
        "contact_created_by_name": { "name": "", "id": "" },
        "contact_created_by_id": "",
        "update_text": "",
        "internal": "",
        "aop_case_updates_threaded": "",
        "cev01_vehicles_cases_name": { "name": "", "id": "" },
        "cev01_vehicles_casescev01_vehicles_ida": "",
        "editable": true
      },
      "_id": "4600f72c-56b6-6970-4dee-65b45c09db90"
    }
  },
  "query": "mutation saveRecord($input: saveRecordInput!) {\n  saveRecord(input: $input) {\n    record {\n      attributes\n      favorite\n      id\n      _id\n      module\n      acls\n      __typename\n    }\n    __typename\n  }\n}"
}
1 Like

@ctucker1984 You found a bug, next step is report it on github so it can be fixed for all users in the next release.
Create your new issue here!

Issue submitted:
Case Status Not Saving #426

1 Like