I'm trying to change the CustomerUserID of some existing users depending on some flags using the CustomerUser method "CustomerUserUpdate", but I'm facing an issue when trying to get it done.
I have taken as an example the call from Kernel/System/CustomerCompany/Event/CustomerUserUpdate.pm, you can see it in GitHub here -> https://github.com/znuny/Znuny/blob/dev ... rUpdate.pm.
The piece of code I'm referring to is the following
Code: Select all
$CustomerUserObject->CustomerUserUpdate(
%CustomerData,
ID => $CustomerUserLogin,
UserCustomerID => $Param{Data}->{CustomerID},
UserID => $Param{UserID},
);
Code: Select all
$UserObject->CustomerUserUpdate(
%UserData,
ID => $UserData{UserLogin},
UserCustomerID => $customerID,
UserID => $UserData{UserID}
);
Message: Incorrect integer value: 'some_username' for column `otrs`.`customer_user`.`change_by` at row 3967, SQL: 'UPDATE customer_user SET title = ?, first_name = ?, last_name = ?, login = ?, email = ?, customer_id = ?, phone = ?, fax = ?, mobile = ?, street = ?, zip = ?, city = ?, country = ?, comments = ?, valid_id = ?, change_time = '2023-05-24 15:14:29', change_by = ? WHERE LOWER(login) = LOWER(?)'
I have realized that both $UserData{UserLogin} and $UserData{UserID} gives me the same value, which is the one for 'some_username'. Does anyone know how I can realize this call to get the proper user id in the update command? Or if there's a better way to accomplish my objective?
Thank you in advance! :)