[rt-users] Scrips - accessing "requestor" name from a ticket that has just b een created

Maciak, TJ tmaciak at ci.grand-rapids.mi.us
Tue Jul 12 15:29:46 EDT 2005


I have written a scrip that states following:
 
Description: Add Department to Ticket
Condition: On Create
Action: User Defined
Template: Global Template: Blank
Stage: Transaction Create
 
Custom condition: none
Custom action preparation code: return 1;
Custom action cleanup code:
$RT::Logger->debug( "COGR - testscript #21");
 
my $people = $Ticket->Requestors->UserMembersObj;
my $requestor=$people->Next || undef
 
my $department = "unknown";
 
if ($requestor) {
 $UserObj->Load($requestor->id);
 $department = $UserObj->FirstCustomFieldValue('Department');
}
$RT::Logger->debug( "COGR - testscript #21 for department: $department");
return undef;

=========================================================
 
Now I want to fetch the "Requestors" field of a new ticket with this on
create scrip, then lookup that
requestor and grab a custom field (Department) and then place it in another
object related to the ticket called "DepartmentTicket".
 
However, $Ticket doesnt yet exist (at least I dont think so), so how would I
go about grabbing
the requestor field from the Create.html file?
 
Thanks,
 
T.J. Maciak

Internet/Intranet Developer
Department of IT
City of Grand Rapids
P: (616)456-3713
F: (616)456-3448


 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20050712/65798d06/attachment.htm>


More information about the rt-users mailing list