[rt-users] Custom field not mandatory in all queues

Kenneth Crocker KFCrocker at lbl.gov
Fri Feb 6 18:53:01 EST 2009


Laura,


	You could create a scrip that looks something like this:

Description: Validate Customer
Condition: On Resolve
Action: User-Defined

Custom Action Prep Code:

return 1;

Custom Action Cleanup Code:

my $ticket = $self->TicketObj;

if  $ticket->FirstCustomFieldValue('Customer') ne ' '
     return 1
else
     $ticket->SetStatus("open");
     return 1;


	What this will do is when someone changes the status to "resolved" it 
will check to make sure the CF "Customer" isn't blank. If it isn't, no 
problem, no changes. If it IS blank, the Ticket Status is re-set to "open".
	You can also create a notification scrip to check for the same thing 
only the action is to send an Email using a template that sends someone 
a message on the need to put customer info in the ticket.

Description: Customer Missing on Resolved
Condition: User-defined
Action: Notify Owner (or whomever)
Template: Missing Customer (you create this)

Custom Condition:
# Check for Ticket Status changed to "resolved"

my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;

if  ($trans->Type eq "Status" &&
      $trans->NewValue eq "resolved") &&
      $ticket->FirstCustomFieldValue('Customer') eq ' '
      return 1;



	Hope this helps.

Kenn
LBNL

On 2/6/2009 1:30 PM, Laura Grella wrote:
> Thanks Kenn,
> 
> It has been at least 6 months since I have done any scrip coding and was
> wondering if you had any sample code that would check the field and return 0
> when empty? I'd really appreciate it.
> 
> Thanks,
> Laura
> 
> Kenneth Crocker wrote:
>> Laura,
>>
>> 	I'm only on 3.6.4 so my comment may be out of date. I don't think 
>> that's possible in configuration. If a CF is set up to be mandatory, 
>> then whenever it is applied to a queue, those tickets will require an 
>> entry. What you can do is remove the "Mandatory" setting and then write 
>> a scrip for the queues you want it to be mandatory in and do a return 0 
>> when checking it against the desired transactions and it is empty. Hope 
>> this helps.
>>
>>
>> Kenn
>> LBNL
>>
>> On 2/6/2009 12:33 PM, Laura Grella wrote:
>>> Is there a way to make a custom field mandatory in 3 queues, but not
>>> mandatory in a 4th queue?
>>>
>>> Thanks,
>>> Laura
>> _______________________________________________
>> 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