Hi Team,
SuiteCRM-8.7.1
I’m facing an issue where records created via the SuiteCRM UI can be edited and saved without problems. Records created via my API are also saved correctly; however, when I try to edit these API-created records through the UI, I get an error “Error occurred while saving record”.
Editing both types of records directly in the database works fine, so the issue only occurs when editing API-created records via the UI.
API:
$stmt = $pdo->prepare(“INSERT INTO contacts (id, first_name, last_name, phone_work, date_entered, deleted) VALUES (?, ?, ?, ?, ?, ?)”);
$stmt->execute([$uuid, “Anonymous”, “User”, “123456789”, $time, 0]);
Hi @Amr7
This issue happens because direct SQL inserts skip SuiteCRM’s internal logic. The UI expects fields like modified_user_id
, created_by
, assigned_user_id
, and team_id
to be set — which the API or ORM normally handles.
Recommendation: Use the SuiteCRM REST API to create records — it ensures everything is stored properly.
If you stick with SQL, make sure to include those key fields, or the UI may fail when editing.
Hi,
Thanks for your help.
I tried to set the new fields (modified_user_id, created_by, assigned_user_id), but I got the same error, also (team_id) does not exist in the table.
It might be that team_set_id
is required instead of team_id
— that’s common in SuiteCRM 8.x. Also, make sure you’re setting date_modified
, created_by
, and modified_user_id
with valid values.
Double-check if any required fields (including custom ones) are missing — that can also cause save errors.
If it still fails, check the browser console or SuiteCRM logs for more clues
I added this field with a real value, but I’m still getting the same error.
The browser console doesn’t show any errors.
The SuiteCRM logs show:
app.ERROR: Database failure. Please refer to suitecrm.log for details. {"exception":"[object] (Exception(code: 1))"
@Amr7
Thanks for sharing that. Since you’re still getting the error and SuiteCRM logs mention a database failure, the issue might be with how the data is being inserted — maybe a missing required field or invalid value.
Here’s what I suggest:
- Open the
suitecrm.log
file and look for the full error message around the time of the save attempt — that should point to the exact issue (like a specific field or query).
- Double-check custom fields or dropdowns — inserting values that don’t exist in dropdown options can also trigger save errors.
- Lastly, ensure you’re inserting a valid UUID for
id
and related fields like created_by
or assigned_user_id
.
1 Like
Hi,
Thanks, @Urvi
.
Okay, it’s fixed. The issue was that it must be a valid UUID for both the task ID and the connected/related contact ID.
1 Like