Ticket Insertion Issues

Hi -

I have custom scripts that create new RT tickets by inserting a manual INSERT record into the ‘Tickets’ table. This has worked for us in the past, however if we do it this way, we are unable to do the following

  •      Change its category
    
  •      Change its owner
    

Basically, we can reply to the ticket and close it, but that’s about it. It errors out with a SQL statement when trying to change owners. Attached is the full SQL query, it seems it’s missing GroupMember ID, so
I suppose I have to insert a record into another table for it to play nice.

                  1 Query       SELECT  * FROM Tickets WHERE id = '34956'
                  1 Query       SELECT  * FROM Users WHERE id = '102618'
                  1 Query       SELECT  * FROM Queues WHERE id = '1'

                  1 Query       SELECT ACL.id, ACL.ObjectType, ACL.ObjectId FROM ACL, Principals, CachedGroupMembers WHERE (ACL.RightName = 'SuperUser' OR ACL.RightName = 'ModifyTicket') AND Principals.id = ACL.PrincipalId AND Principals.PrincipalType = 'Group' AND Principals.Disabled = 0 AND CachedGroupMembers.GroupId  = ACL.PrincipalId AND CachedGroupMembers.GroupId  = Principals.id AND CachedGroupMembers.MemberId = 102618 AND CachedGroupMembers.Disabled = 0  AND ((ACL.ObjectType = 'RT::System' AND ACL.ObjectId = 1) OR (ACL.ObjectType = 'RT::Queue' AND ACL.ObjectId = 1) OR (ACL.ObjectType = 'RT::Ticket' AND ACL.ObjectId = 34956)) LIMIT 1

                  1 Query       SELECT ACL.id, ACL.ObjectType, ACL.ObjectId FROM ACL, Principals, CachedGroupMembers WHERE (ACL.RightName = 'SuperUser' OR ACL.RightName = 'OwnTicket') AND Principals.id = ACL.PrincipalId AND Principals.PrincipalType = 'Group' AND Principals.Disabled = 0 AND CachedGroupMembers.GroupId  = ACL.PrincipalId AND CachedGroupMembers.GroupId  = Principals.id AND CachedGroupMembers.MemberId = 102618 AND CachedGroupMembers.Disabled = 0  AND ((ACL.ObjectType = 'RT::System' AND ACL.ObjectId = 1) OR (ACL.ObjectType = 'RT::Queue' AND ACL.ObjectId = 1) OR (ACL.ObjectType = 'RT::Ticket' AND ACL.ObjectId = 34956)) LIMIT 1


                  1 Query       SELECT  * FROM Groups WHERE Instance = '34956' AND Type = 'Owner' AND Domain = 'RT::Ticket-Role'
                  1 Query       SELECT main.* FROM GroupMembers.main  WHERE (main.GroupId = )
                  1 Query       SELECT RELEASE_LOCK('Apache-Session-742dc9bf13d6e193159d5960231dc916')
                  1 Query       rollback
                  1 Query       set autocommit=1

Any suggestions you can provide would be helpful.

Brandon Rogge wrote:

Hi -

I have custom scripts that create new RT tickets by inserting a manual
INSERT record into the ‘Tickets’ table.

Simple answer: don’t do that. Even if you solve your immediate problem,
your scripts can’t be future proof and may (will) break with RT upgrades.

Use the REST interface instead. If using perl, see RT::Client::REST on
CPAN. For ruby… wait another week and a gem will be available.

– ============================
Tom Lahti
BIT Statement LLC

(425)251-0833 x 117
http://www.bitstatement.net/
– ============================