Error when sending to no requestor

Is there a way to have RT throw an error when replying to a ticket with no requestor specified?

The ticket doesn’t give us an error in this particular case because there are still AdminCC’s, so an email is still sent, however where we’re trying to correspond with external customers we’re having instances where the requestor field is blank and our team is believing they’re sending an external email, when in reality they’re not sending anything to the end-user at all.

A callback might work for you. For example the Ticket/Update.html has a callback called Initial that you could use to check if the ticket object has a requestor and the Action is set to “Respond”. You could then generate an error, force the update to fail and pop a message up. Try this for size for example:

<%init>
if($Ticket->Requestor && $$ARGSRef{'Action'} eq 'Respond') {
    $$checks_failure = 1;
    push @$results, loc("You can not reply as there is no requestor! Please add\
 a requestor before attempting to reply.");
    $$ARGSRef{'UpdateType'} = 'private';
    $$ARGSRef{'Action'} = 'Comment';
}
</%init>
<%ARGS>
$ARGSRef => undef
$Ticket => undef
$checks_failure => undef
$results => undef
</%ARGS>

Pop this into a file called Initial in your local callbacks directory structure (see here if you’ve not used callbacks before - it’ll probably be something like /opt/rt4/local/html/Callbacks/MyCallbacks/Ticket/Update.html/Initial and you will probably need to create some of those directories - they aren’t made by default). Then clear the Mason cache, restart the webserver and give it a go.

You could get fancier than this - for example redirecting to a special local page that has a big flashing warning using $m->redirect('/MyBigWarning.html'); - but hopefully this will give you a starting point.

1 Like

I’ll check that out, thanks a bunch!