[rt-users] Problem creating scrip.

AJ rt at musefoundry.com
Mon Jan 26 15:50:41 EST 2004


The linkobj has not been instantiated yet.

A little ugly but this may get you started..

On create

Prep Code: 
1

Commit code:
  $found=0;
  my $members = $self->TicketObj->MemberOf;
  while (my $link = $members->Next) {
    my $member= $link->BaseObj;
    my $CustomFields = $member->TicketObj->QueueObj->CustomFields;
    $CustomFields->LimitToQueue;
   while (my $CustomField = $CustomFields->Next) {
    #$RT::Logger->debug("Checking Field: " . $CustomField->Name);
    if ($CustomField->Name=~/<field looking for>/ {
      my $ParentFields = $self->TicketObj->QueueObj->CustomFields;
      while (my $ParentField = $ParentFields->Next) {
	   if ($ParentField->Name=~/<field looking for>/ {
              <code to set custom field (don't know methods off hand and was
wondering if you could forward me that code when done) >
	   }
	}
      $RT::Logger->debug("Found custom field " . $CustomField->Name . " in
parent and set in child, hopefully");
      $found=1
      last; #dont need to go any farther
    }
    Last if ($found==1); #found memberof with pertinent custom field so stop
going through members.
   }
  }
return 1;
	


A.J.


-----Original Message-----
From: rt-users-bounces at lists.bestpractical.com
[mailto:rt-users-bounces at lists.bestpractical.com] On Behalf Of Todd Chapman
Sent: Monday, January 26, 2004 10:50 AM
To: rt-users at lists.bestpractical.com
Subject: [rt-users] Problem creating scrip.


I'm try to create a user defined scrip. What I want to do
is when a ticket is created, if it is a MemberOf (child of)
another ticket, and the partent ticket has a certain custom
field set, set the same value in the new ticket.

In other words, I am trying to propogate a custom field
value to the children of a ticket, at ticket creation time.

Here is my custome action preparation code so far:

my $Ticket = $self->TicketObj;
my $LinkObj = $Ticket->MemberOf;
my $Link = $LinkObj->Next;

Is is the 3rd line which triggers this error:

Jan 26 07:20:13 slah001 RT: RT::Scrip=HASH(0x9b52884): Couldn't prepare User
Defined (/opt/rt3/lib/RT/Scrip_Overlay.pm:346)

Can anyone spot the problem?

Thanks.

-Todd

_______________________________________________
rt-users mailing list
rt-users at lists.bestpractical.com
http://lists.bestpractical.com/mailman/listinfo/rt-users

Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm




More information about the rt-users mailing list