Access Keys:
Skip to content (Access Key - 0)

Set an RT Custom Field automatically on ticket creation

Context

  • Request Tracker (RT) on help.mit.edu
  • Request Tracker queue administrators

Answer

This article explains how to set a Custom Field attached to your queue to a default value whenever a ticket is created. There are many reasons you might want to do this. A common use case is a flag attached to your tickets that is almost always set to the same value, but occasionally needs to be set to something else.

For example, you might have a "Send Survey" custom field that determines whether a customer receives a follow-up satisfaction survey or not. This field is almost always set to "Yes", but you may want to set it to "No" occasionally to prevent a survey from being done. We will use this example to illustrate the procedure below.

Make sure the custom field exists and has been attached to a queue for which you are the queue administrator; for more information on how to do this please see Creating and managing Request Tracker Custom Fields.

Next, create a user-defined Scrip for your queue that sets the field whenever a ticket is created. If you do not see the "User Defined" text areas, you may not have the necessary permissions to create custom Scrips for your queue.

  1. Navigate to Tools > Configuration > Queues > Select and click on your queue in the list of queues
  2. Navigate to the Scrips tab, hover over it, and click on Create
  3. Enter a new Scrip with the following settings:
    • Description: On Create set Send Survey custom field to Yes (or something similar)
    • Condition: On Create
    • Action: User Defined
    • Template: Global template: Blank
    • Stage: TransactionCreate (this is the default)
    • Custom condition: (leave blank)
    • Custom action preparation code:
      return 1;
      
    • Custom action cleanup code:
      my $CFName = 'Send Survey';
      my $DefaultValue = 'Yes';
      
      unless( $self->TicketObj->FirstCustomFieldValue( $CFName ) eq $DefaultValue ) {
      	my( $st, $msg ) = $self->TicketObj->AddCustomFieldValue(
                                              Field => $CFName,
                                              Value => $DefaultValue,
                                              RecordTransaction => 1 );
      }
      return 1;
      
  4. Click the Create button to save your custom Scrip

Be sure to replace "Send Survey" and "Yes" in the above example with the appropriate values for your queue.

See also

IS&T Contributions

Documentation and information provided by IS&T staff members


Last Modified:

October 16, 2013

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
Labels:
c-rt-queue-admin c-rt-queue-admin Delete
request_tracker request_tracker Delete
rt rt Delete
rt4 rt4 Delete
c-rt-queue-admin-shortcut c-rt-queue-admin-shortcut Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
Feedback
This product/service is:
Easy to use
Average
Difficult to use

This article is:
Helpful
Inaccurate
Obsolete
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki