[rt-users] getting the values of custom fields

anthony acqant at optonline.net
Tue Feb 13 21:45:07 EST 2007


Kenneth,
	Thanks for sticking with me.  I'm tailing the logs and see errors when
ever I put something invalid in the Custom action section.

	If I put something (debug) into the custom condition It doesn't get any
output.  I have user defined only for Action.

	Right now I'm trying to add a package to the RT::Action section.



Kenneth Crocker wrote:
> Anthony,
> 
> 
>     We merely click new scrip, on owner change (but you could pick any
> trigger), then put the perl code into the custom condition section of
> the scrip. Works great for us. Have you looked at your error logs?
> 
> Kenn
> LBNL
> 
> anthony wrote:
>> Where are you doing this the webui?  I'm using
>> configure-queue-script-new script-condition: on status change, action:
>> user defined.
>>
>> In the preparation section I put
>> $RT::Logger->debug("SCRIPT: $TicketObj->OwnerObj->Name\n");
>>
>> It should be $self->TicketObj
>>
>> I then ran it again and got
>>  SCRIPT:
>> RT::Action::UserDefined=HASH(0xcc9e670)->TicketObj->OwnerObj->Name()
>>
>>
>> The perldoc Ticket_Overlay has CustomFieldValues which sends you to
>> ObjectCustomFieldValues_Overlay which has
>>
>>  LimitToCustomField FIELD
>>
>>        Limits the returned set to values for the custom field with Id
>> FIELD
>>
>>        LimitToTicket TICKETID
>>
>>        Limits the returned set to values for the ticket with Id TICKETID
>>
>>        Returns true if this CustomFieldValues collection has an entry
>> with
>>        content that eq VALUE
>>
>>
>> Neither of which return anything.
>>
>>
>>
>>
>>
>> Kenneth Crocker wrote:
>>> Anthony,
>>>
>>>
>>>     We use the following code to send a notification, via a scrip custom
>>> condition, when the owner changes, providing the owner isn't "nobody":
>>>
>>> return ( $TicketObj->OwnerObj->Name() ne 'Nobody' );
>>>
>>>     Maybe this will help you build your code in a scrip.
>>>
>>>
>>> Kenn
>>> LBNL
>>>
>>> anthony wrote:
>>>> I'm doing this via script action.
>>>> FirstCustom.. is in Record which is not part of the $self.
>>>>
>>>> I get TicketObj, TransactionObj ( which does not seems to work )
>>>>
>>>> I'm tried to use CustomFieldValues but I get stuck after that.
>>>>
>>>> Searches through the archive seem to say NO ONE has done this
>>>> successfully.
>>>>
>>>>
>>>> Kenneth Crocker wrote:
>>>>> Anthony,
>>>>>
>>>>>     What are you using the data for? We pull some custom data to
>>>>> use on
>>>>> our "Resolve" template. It is as follows:
>>>>>
>>>>> RT-Attach-Message: yes
>>>>> Subject: Resolved: {$Ticket->Subject}
>>>>>
>>>>> Your request has been resolved. If you have any further questions or
>>>>> concerns,
>>>>> please respond to this message.
>>>>>
>>>>> To view ticket information, enter URL:
>>>>>     {$RT::WebURL}Ticket/Display.html?id={$Ticket->id} .
>>>>> -----------------------------------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Ticket Description:
>>>>> {
>>>>>      my $Resolution_Description;
>>>>>      $Resolution_Description =
>>>>> $Ticket->FirstCustomFieldValue('Description');
>>>>>      return $Resolution_Description;
>>>>> }
>>>>> -----------------------------------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Resolution:
>>>>> {
>>>>>      my $Resolution_Comment;
>>>>>      my $Transactions;
>>>>>      my $CommentObj;
>>>>>
>>>>>      $Transactions = $Ticket->Transactions;
>>>>>      $Transactions->Limit( FIELD => 'Type', VALUE => 'Comment' );
>>>>>      $Transactions->OrderByCols(
>>>>>          { FIELD => 'Created',  ORDER => 'DESC' },
>>>>>          { FIELD => 'id',     ORDER => 'DESC' },
>>>>>          );
>>>>>
>>>>>      $CommentObj = $Transactions->First;
>>>>>
>>>>>      if  ($CommentObj && $CommentObj->id)
>>>>>      {
>>>>>           $Resolution_Comment = $CommentObj->Content;
>>>>>      }
>>>>>
>>>>>      return $Resolution_Comment;
>>>>> }
>>>>>
>>>>>     Hope this helps.
>>>>>
>>>>> Kenn
>>>>> LBNL
>>>>>
>>>>> anthony wrote:
>>>>>> I'm using 3.4.6 and have a ticket that has some CustomField values.
>>>>>>
>>>>>> I'm having a horrible time pulling these entries.
>>>>>>
>>>>>> I'm doing this via the web and User Defined scripts.  For testing I'm
>>>>>> saying On status change run this action.
>>>>>>
>>>>>> I've been messing with Ticket_Overlay CustomValues, CustomValues,
>>>>>> TicketTransactions....
>>>>>>
>>>>>> Now I'm wondering if the data is just for the status change
>>>>>> transaction
>>>>>> and the values in the custom fields are not even in the $self data.
>>>>>>
>>>>>> Does this sound right?
>>>>>>
>>>>>> Doing this via sql sounds much simpler.
>>>>>> _______________________________________________
>>>>>> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>>>>>>
>>>>>> Community help: http://wiki.bestpractical.com
>>>>>> Commercial support: sales at bestpractical.com
>>>>>>
>>>>>>
>>>>>> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
>>>>>> Buy a copy at http://rtbook.bestpractical.com
>>>>>>
>>
> 




More information about the rt-users mailing list