[rt-users] "No object mapping for field" when referencing the UserObject of a MembersObject...
Johnathan Bell
johnathan.bell at baker.edu
Thu May 21 13:46:10 EDT 2009
Please let me know if this is supposed to go to RT-Users or RT-Devel.
I'm trying to write a utility to interface with Request Tracker, and
part of what that utility has to do is get the members of some user
created groups. Just sub in actual groups for what you want in there,
CurrentUser works and is already initialized by the time my program gets
here. Mostly borrowing this code from the old rtimportldap script, I
came up with this:
--code--
# RT Group
$groupObj = new RT::Group($CurrentUser);
$groupObj->LoadUserDefinedGroup($groupName);
$groupObj->Id() || die "Group ".$groupName." not found in
RequestTracker";
$groupMembersObj = $groupObj->MembersObj();
print $groupObj->Id().":".$groupObj.":".$groupMembersObj.":"
.$groupMembersObj->Next()->UserObj()."\n"; ## This creates an error
while ( $groupMember = $groupMembersObj->Next() )
{
$groupMemberUser = $groupMember->UserObj();
print $groupMemberUser->Name()."\n"; ## This does too
#$memberName = $groupMemberUser->Name();
#push(@rtMembers, $memberName);
}
--/code--
What it seems is that GroupObj->MembersObj()->Next()->UserObj() causes
the problem, as UserObj() returns, not a UserObject, but a string
stating "No object mapping for field" Attempting to use the Name()
function of course doesn't work because "No object..."->Name() doesn't
make sense... What's going on?
Thanks,
Johnathan
--
Johnathan Bell
Internet System Administrator, Baker College
More information about the rt-users
mailing list