Create new User: assigned ldap value to custom user field is overwritten

I’m currently setting up RT 3.6.4 on a CentOs 5 box.

Basically, when we create a new user, we simply type in the new users’
network id and click save. We have overwritten CanonicalizeUserInfo and
Create in Users_Local to lookup the users data from ldap and set the
data in the proper fields. Everything works fine with the exception of
a custom user field we assign a value to.

Basically, what happens is the custom field value is assigned, then
immediately is overwritten by the value of the web page form, in our
case the value is blank. I know this happens because if you look the
results widget (on the web page), you see the following entries…

User created

Streets and Sanitation is no longer a value for custom field Department

And if you look at the history, you’ll see the following entries…

crpatter - User created

crpatter - Department Streets and Sanitation deleted

So it seems the following happens…

The user is created.

The custom field is manually assigned a value in our custom code.

The custom field value is overwritten by the normal RT procedure.

I’ve searched through the wiki and the mailing list and can’t find
anyone else who has encountered this problem. Perhaps, there is a
better place to assign the custom field value?

Any advice is greatly appreciated.

Craig Patterson

Application Developer/SDE Administrator

Northrop Grumman IT/City of Grand Rapids

(616)456-3645

crpatter@grcity.us

I figured this one out, though I’m not crazy about my solution. I had
to modify /rthome/share/html/Admin/Users/Modify.html(in my local
directory of course!)

Since I know the custom field id I didn’t want to get overwritten, I
simply prevented it from being added to %ARGS. There may be a more
elegant solution, but this works. At least with this solution if we
create another custom field, it will get its value added.

    foreach my $key ( keys %ARGS) {

        # Convert custom fields on the "new" object to custom fields

on the one we’ve just created

        if ($key =~ /^Object-RT::User-new-CustomField-(.*)$/) {

                    unless($1 == $departmentCustFieldId){

$ARGS{‘Object-RT::User-’.$val.‘-CustomField-’.$1} = delete $ARGS{$key};

                    }

        }

    }

[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of
Patterson, CraigSent: Monday, September 10, 2007 5:35 PM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] Create new User: assigned ldap value to custom
userfield is overwritten

I’m currently setting up RT 3.6.4 on a CentOs 5 box.

Basically, when we create a new user, we simply type in the new users’
network id and click save. We have overwritten CanonicalizeUserInfo and
Create in Users_Local to lookup the users data from ldap and set the
data in the proper fields. Everything works fine with the exception of
a custom user field we assign a value to.

Basically, what happens is the custom field value is assigned, then
immediately is overwritten by the value of the web page form, in our
case the value is blank. I know this happens because if you look the
results widget (on the web page), you see the following entries…

User created

Streets and Sanitation is no longer a value for custom field Department

And if you look at the history, you’ll see the following entries…

crpatter - User created

crpatter - Department Streets and Sanitation deleted

So it seems the following happens…

The user is created.

The custom field is manually assigned a value in our custom code.

The custom field value is overwritten by the normal RT procedure.

I’ve searched through the wiki and the mailing list and can’t find
anyone else who has encountered this problem. Perhaps, there is a
better place to assign the custom field value?

Any advice is greatly appreciated.

Craig Patterson

Application Developer/SDE Administrator

Northrop Grumman IT/City of Grand Rapids

(616)456-3645

crpatter@grcity.us