If you wanted to do it in Perl, and assuming you had the ticket object for the ticket you’re interested in in $Ticket, I think something like this should do it:
my $Draft = RT::Attribute->new( $session{'CurrentUser'} );
$Draft->LoadByNameAndObject( Object => $session{'CurrentUser'}->UserObj, Name => 'Draft-'.$Ticket->id );
$Draft->Delete if ( $Draft && $Draft->Id );
That was totally lifted out of the extension’s code.
thanks for reply.
yes, you’re right - there is such a code. and it even works - the draft is really deleted after saving the ticket. Now I don’t understand why I have several drafts in this table …
I understand.
The draft is only deleted if the user has changed the ticket. if for some reason the changes in the ticket were not saved, the draft will remain in the database.