Update user custom field value via script

My version is 3.6.4

I’m working on a script to update users’ data from LDAP. Everything is
working fine for the most part, but updating a custom field.

If I use code like this, the value is “updated”…

my $CFObj = new RT::CustomField($RT::SystemUser);

$UserObj->AddCustomFieldValue (
Field => $CFObj->id,
Value => $department,
RecordTransaction => 1

The problem with this approach is that it doesn’t update the record, it
creates new record and disables the old value.

So, I’m attempting the update the record like this…

my $CFs = $UserObj->CustomFields;
while (my $CF = $CFs->Next){
if ($CF->Name eq ‘Department’){
my @cfAttribs = (‘CONTENT’);
my %cfArgs = {
CONTENT => $ARGS{‘Department’}

	my @results = $CF->Update(
		Attributes => \@cfAttribs,
		ARGSRef => \%cfArgs


… which is not updating the record.

I’ve dug through the wiki and through the mailing list, but all examples
I’ve found use the AddCustomFieldValue method.

Any Suggestsion

Craig Patterson
Application Developer
Northrop Grumman IT/City of Grand Rapids