RT CLI and Custom Fields

Yeah, I was able to create a basic ticket with the rt command, but nothing
with custom fields. Even if I have a queue with a defined custom field, any
method I’ve tried to submit the value of that custom field seems to trigger
an error (I show ‘edit’ below, but ‘create’ is the same).

Looking at the RT command help:

rt help edit

“set” sets the named field to the given value

-S var=val
Submits the specified variable with the request.

So I try:

rt edit ticket/33 set custom_field=value
rt: edit: No variables to set

or…

rt edit ticket/33 -S custom_field=value
rt: edit: Invalid variable specification: ‘custom_field=value’.

So it doesn’t look like the rt CLI is even aware of custom fields. Can
someone confirm this for me? If so, are there plans to add that
functionality?

Thanks,

Ryan Roland

Network and Security Administrator
Information Technology
Division of Recreational Sports
Indiana University

SRSC 115H
1601 Law Lane
Bloomington, IN 47405

812.855.9617
rmroland@indiana.eduFrom: Stephane Bortzmeyer [mailto:bortzmeyer@nic.fr]
Sent: Wednesday, April 27, 2005 02:59
To: Roland, Ryan M
Subject: Re: Inserting Jobs with PHP

a message of 152 lines which said:

If anyone can show me how to use the rt command to create a ticket
and more explicitly set custom fields,

I assume that you know “rt create -t ticket subject=‘new ticket’
priority=10”. Otherwise, I do not know about custom fields and I do
not use them so I cannot help.

smime.p7s (2.96 KB)

has anyone successfully used the CLI to query RT Custom fields? I found
a few posts, but with no responses.

Here is an example:

/opt/rt3/bin/rt list -i (‘CF.{Severity Level}’ = ‘Sev 3’")

I always receive this error:

-bash: syntax error near unexpected token `(’

Thanks,

  • Stark

has anyone successfully used the CLI to query RT Custom fields? I
found a few posts, but with no responses.

Here is an example:

/opt/rt3/bin/rt list -i (‘CF.{Severity Level}’ = ‘Sev 3’")

This works fine for me

./bin/rt ls -i ‘CF.{foo} = “bar”’

-kevin

has anyone successfully used the CLI to query RT Custom fields? I
found a few posts, but with no responses.

Here is an example:

/opt/rt3/bin/rt list -i (‘CF.{Severity Level}’ = ‘Sev 3’")

This works fine for me

./bin/rt ls -i ‘CF.{foo} = “bar”’

-kevin

Are you using version 3.6? 3.4 does not support accessing Custom
fields from the CLI.

Ken

Sorry…3.6.3

Jeff Stark, Sr Systems Administrator
SumTotal Systems, Inc. (Nasdaq; SUMT)

OFFICE +1 919 326 7548
MOBILE +1 919 622 0418

EMAIL jstark@sumtotalsystems.com

The contents of this communication are considered SumTotal Confidential,
and should not be shared with anyone outside of SumTotal, either
electronically or verbally, without the express permission of the
author(s).From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Kenneth
Marshall
Sent: Thursday, July 05, 2007 4:35 PM
To: Kevin Falcone
Cc: RT Users
Subject: Re: [rt-users] RT CLI and Custom Fields

has anyone successfully used the CLI to query RT Custom fields? I
found a few posts, but with no responses.

Here is an example:

/opt/rt3/bin/rt list -i (‘CF.{Severity Level}’ = ‘Sev 3’")

This works fine for me

./bin/rt ls -i ‘CF.{foo} = “bar”’

-kevin

Are you using version 3.6? 3.4 does not support accessing Custom fields
from the CLI.

Ken
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com Commercial support:
sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

I just tried very similar to what you have Kevin, still no luck.

[jstark@server obj]# /opt/rt3/bin/rt list -i (‘CF.{Severity Level} =
“Sev 3”’)
-bash: syntax error near unexpected token `(’

has anyone successfully used the CLI to query RT Custom fields? I
found a few posts, but with no responses.

Here is an example:

/opt/rt3/bin/rt list -i (‘CF.{Severity Level}’ = ‘Sev 3’")

This works fine for me

./bin/rt ls -i ‘CF.{foo} = “bar”’

-kevin
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com Commercial support:
sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Why are you putting the value in parentheses? The simple string
in single quotes should work.

KenOn Fri, Jul 06, 2007 at 07:10:59AM -0700, Jeff Stark wrote:

I just tried very similar to what you have Kevin, still no luck.

[jstark@server obj]# /opt/rt3/bin/rt list -i (‘CF.{Severity Level} =
“Sev 3”’)
-bash: syntax error near unexpected token `(’

  • Stark

-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Kevin
Falcone
Sent: Thursday, July 05, 2007 3:59 PM
To: RT Users
Subject: Re: [rt-users] RT CLI and Custom Fields

On Jul 5, 2007, at 3:16 PM, Jeff Stark wrote:

has anyone successfully used the CLI to query RT Custom fields? I
found a few posts, but with no responses.

Here is an example:

/opt/rt3/bin/rt list -i (‘CF.{Severity Level}’ = ‘Sev 3’")

This works fine for me

./bin/rt ls -i ‘CF.{foo} = “bar”’

-kevin


The rt-users Archives

Community help: http://wiki.bestpractical.com Commercial support:
sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

When I remove the parenthesis and try this I get the following:

[jstark@server obj]# /opt/rt3/bin/rt list -i ‘CF.{Severity Level} = “Sev
3”’
rt: Invalid query: ‘’.
Invalid query: ‘’.

[jstark@server obj]# /opt/rt3/bin/rt list -i “CF.{Severity Level} = ‘Sev
3’”
rt: Invalid query: ‘’.
Invalid query: ‘’.

-StarkFrom: Kenneth Marshall [mailto:ktm@rice.edu]
Sent: Friday, July 06, 2007 10:18 AM
To: Jeff Stark
Cc: Kevin Falcone; RT Users
Subject: Re: [rt-users] RT CLI and Custom Fields

Why are you putting the value in parentheses? The simple string in
single quotes should work.

Ken

Wow. The next step for me would be to run the CLI rt in debug mode
and check that the commandline arguments are being passed in correctly.
It may be that you need to do some more escaping to have it work.

KenOn Fri, Jul 06, 2007 at 07:43:25AM -0700, Jeff Stark wrote:

When I remove the parenthesis and try this I get the following:

[jstark@server obj]# /opt/rt3/bin/rt list -i ‘CF.{Severity Level} = “Sev
3”’
rt: Invalid query: ‘’.
Invalid query: ‘’.

[jstark@server obj]# /opt/rt3/bin/rt list -i “CF.{Severity Level} = ‘Sev
3’”
rt: Invalid query: ‘’.
Invalid query: ‘’.

-Stark

-----Original Message-----
From: Kenneth Marshall [mailto:ktm@rice.edu]
Sent: Friday, July 06, 2007 10:18 AM
To: Jeff Stark
Cc: Kevin Falcone; RT Users
Subject: Re: [rt-users] RT CLI and Custom Fields

Why are you putting the value in parentheses? The simple string in
single quotes should work.

Ken

On Fri, Jul 06, 2007 at 07:10:59AM -0700, Jeff Stark wrote:

I just tried very similar to what you have Kevin, still no luck.

[jstark@server obj]# /opt/rt3/bin/rt list -i (‘CF.{Severity Level} =
“Sev 3”’)
-bash: syntax error near unexpected token `(’

  • Stark

-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Kevin
Falcone
Sent: Thursday, July 05, 2007 3:59 PM
To: RT Users
Subject: Re: [rt-users] RT CLI and Custom Fields

On Jul 5, 2007, at 3:16 PM, Jeff Stark wrote:

has anyone successfully used the CLI to query RT Custom fields? I
found a few posts, but with no responses.

Here is an example:

/opt/rt3/bin/rt list -i (‘CF.{Severity Level}’ = ‘Sev 3’")

This works fine for me

./bin/rt ls -i ‘CF.{foo} = “bar”’

-kevin


The rt-users Archives

Community help: http://wiki.bestpractical.com Commercial support:
sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


The rt-users Archives

Community help: http://wiki.bestpractical.com Commercial support:
sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Strangely enough…this works just fine:

/opt/rt3/bin/rt list -i “Status = ‘in-review’ AND Resolved < ‘2 days
ago’”

-StarkFrom: Kenneth Marshall [mailto:ktm@rice.edu]
Sent: Friday, July 06, 2007 10:47 AM
To: Jeff Stark
Cc: Kevin Falcone; RT Users
Subject: Re: [rt-users] RT CLI and Custom Fields

Wow. The next step for me would be to run the CLI rt in debug mode and
check that the commandline arguments are being passed in correctly.
It may be that you need to do some more escaping to have it work.

Ken

Do any of the CLI custom field queries work? Is the rt command
using the correct RT URL? These errors look similar to ones I
received with RT 3.4.

KenOn Fri, Jul 06, 2007 at 07:52:45AM -0700, Jeff Stark wrote:

Strangely enough…this works just fine:

/opt/rt3/bin/rt list -i “Status = ‘in-review’ AND Resolved < ‘2 days
ago’”

-Stark

-----Original Message-----
From: Kenneth Marshall [mailto:ktm@rice.edu]
Sent: Friday, July 06, 2007 10:47 AM
To: Jeff Stark
Cc: Kevin Falcone; RT Users
Subject: Re: [rt-users] RT CLI and Custom Fields

Wow. The next step for me would be to run the CLI rt in debug mode and
check that the commandline arguments are being passed in correctly.
It may be that you need to do some more escaping to have it work.

Ken

On Fri, Jul 06, 2007 at 07:43:25AM -0700, Jeff Stark wrote:

When I remove the parenthesis and try this I get the following:

[jstark@server obj]# /opt/rt3/bin/rt list -i ‘CF.{Severity Level} =
“Sev 3”’
rt: Invalid query: ‘’.
Invalid query: ‘’.

[jstark@server obj]# /opt/rt3/bin/rt list -i “CF.{Severity Level} =
‘Sev 3’”
rt: Invalid query: ‘’.
Invalid query: ‘’.

-Stark

-----Original Message-----
From: Kenneth Marshall [mailto:ktm@rice.edu]
Sent: Friday, July 06, 2007 10:18 AM
To: Jeff Stark
Cc: Kevin Falcone; RT Users
Subject: Re: [rt-users] RT CLI and Custom Fields

Why are you putting the value in parentheses? The simple string in
single quotes should work.

Ken

On Fri, Jul 06, 2007 at 07:10:59AM -0700, Jeff Stark wrote:

I just tried very similar to what you have Kevin, still no luck.

[jstark@server obj]# /opt/rt3/bin/rt list -i ('CF.{Severity Level} =

“Sev 3”‘)
-bash: syntax error near unexpected token `(’

  • Stark

-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Kevin

Falcone
Sent: Thursday, July 05, 2007 3:59 PM
To: RT Users
Subject: Re: [rt-users] RT CLI and Custom Fields

On Jul 5, 2007, at 3:16 PM, Jeff Stark wrote:

has anyone successfully used the CLI to query RT Custom fields? I

found a few posts, but with no responses.

Here is an example:

/opt/rt3/bin/rt list -i (‘CF.{Severity Level}’ = ‘Sev 3’")

This works fine for me

./bin/rt ls -i ‘CF.{foo} = “bar”’

-kevin


The rt-users Archives

Community help: http://wiki.bestpractical.com Commercial support:
sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.

Buy a copy at http://rtbook.bestpractical.com


The rt-users Archives

Community help: http://wiki.bestpractical.com Commercial support:
sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Got it…the space in the custom field name was causing it to fail…

/opt/rt3/bin/rt list -i “‘CF.{Severity Level}’ = ‘Sev 4’”

That works. Thanks for pushing in the right direction…sometimes I
just need a nudge.

-Stark

The contents of this communication are considered SumTotal Confidential,
and should not be shared with anyone outside of SumTotal, either
electronically or verbally, without the express permission of the
author(s).From: Kenneth Marshall [mailto:ktm@rice.edu]
Sent: Friday, July 06, 2007 11:00 AM
To: Jeff Stark
Cc: Kevin Falcone; RT Users
Subject: Re: [rt-users] RT CLI and Custom Fields

Do any of the CLI custom field queries work? Is the rt command using the
correct RT URL? These errors look similar to ones I received with RT
3.4.

Ken

Strangely enough…this works just fine:

/opt/rt3/bin/rt list -i “Status = ‘in-review’ AND Resolved < ‘2 days
ago’”

-Stark

-----Original Message-----
From: Kenneth Marshall [mailto:ktm@rice.edu]
Sent: Friday, July 06, 2007 10:47 AM
To: Jeff Stark
Cc: Kevin Falcone; RT Users
Subject: Re: [rt-users] RT CLI and Custom Fields

Wow. The next step for me would be to run the CLI rt in debug mode and

check that the commandline arguments are being passed in correctly.
It may be that you need to do some more escaping to have it work.

Ken

When I remove the parenthesis and try this I get the following:

[jstark@server obj]# /opt/rt3/bin/rt list -i ‘CF.{Severity Level} =
“Sev 3”’
rt: Invalid query: ‘’.
Invalid query: ‘’.

[jstark@server obj]# /opt/rt3/bin/rt list -i “CF.{Severity Level} =
‘Sev 3’”
rt: Invalid query: ‘’.
Invalid query: ‘’.

-Stark

-----Original Message-----
From: Kenneth Marshall [mailto:ktm@rice.edu]
Sent: Friday, July 06, 2007 10:18 AM
To: Jeff Stark
Cc: Kevin Falcone; RT Users
Subject: Re: [rt-users] RT CLI and Custom Fields

Why are you putting the value in parentheses? The simple string in
single quotes should work.

Ken

I just tried very similar to what you have Kevin, still no luck.

[jstark@server obj]# /opt/rt3/bin/rt list -i ('CF.{Severity Level}

=

“Sev 3”‘)
-bash: syntax error near unexpected token `(’

  • Stark

-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of
Kevin

Falcone
Sent: Thursday, July 05, 2007 3:59 PM
To: RT Users
Subject: Re: [rt-users] RT CLI and Custom Fields

has anyone successfully used the CLI to query RT Custom fields?

I

found a few posts, but with no responses.

Here is an example:

/opt/rt3/bin/rt list -i (‘CF.{Severity Level}’ = ‘Sev 3’")

This works fine for me

./bin/rt ls -i ‘CF.{foo} = “bar”’

-kevin


The rt-users Archives

Community help: http://wiki.bestpractical.com Commercial support:
sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly
Media.

Buy a copy at http://rtbook.bestpractical.com


The rt-users Archives

Community help: http://wiki.bestpractical.com Commercial support:
sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly
Media.
Buy a copy at http://rtbook.bestpractical.com

Jeff,

You need to use a different syntax currently to use the rt CLI
to edit custom file values. e.g.

query:

rt ls “Queue=‘General’ AND CF.{SomeDefinedCustomField} is not ‘NULL’”

… but the edit would be something like:

rt edit ticket/1 add CF-SomeDefinedCustomField=‘Value’

Where the string “SomeDefinedCustomField” is the numerical value
for the custom field. Alternatively, the RT-REST perl module is
easy to use and works well.

KenOn Fri, Jul 06, 2007 at 08:34:46AM -0700, Jeff Stark wrote:

Hey Ken…sorry to be such a pain…quick question…can you “edit”
ticket custom fields via CLI too?

I have this, but it’s not working…I have a similar item that updates
status and works great. The query up to the | works fine.

/opt/rt3/bin/rt list -i “(Status = ‘new’ OR Status = ‘open’ OR Status =
‘stalled’) AND (‘CF.{Severity Level}’ LIKE ‘Sev 3’ OR ‘CF.{Severity
Level}’ LIKE ‘Sev 4’) AND (‘CF.{Customer}’ LIKE ‘%(p)’ OR
‘CF.{Customer}’ LIKE ‘%(ep)’)” | /opt/rt3/bin/rt edit - set
‘CF.{Severity Level}’=‘Sev 2 (Premier Support ONLY)’

Everything I am seeing would indicate that it should, as if I use
interactive mode, I can see the custom fields in the form.

Any thoughts…thanks again for all of your help so far.

  • Stark

-----Original Message-----
From: Kenneth Marshall [mailto:ktm@rice.edu]
Sent: Friday, July 06, 2007 11:00 AM
To: Jeff Stark
Cc: Kevin Falcone; RT Users
Subject: Re: [rt-users] RT CLI and Custom Fields

Do any of the CLI custom field queries work? Is the rt command using the
correct RT URL? These errors look similar to ones I received with RT
3.4.

Ken

On Fri, Jul 06, 2007 at 07:52:45AM -0700, Jeff Stark wrote:

Strangely enough…this works just fine:

/opt/rt3/bin/rt list -i “Status = ‘in-review’ AND Resolved < ‘2 days
ago’”

-Stark

-----Original Message-----
From: Kenneth Marshall [mailto:ktm@rice.edu]
Sent: Friday, July 06, 2007 10:47 AM
To: Jeff Stark
Cc: Kevin Falcone; RT Users
Subject: Re: [rt-users] RT CLI and Custom Fields

Wow. The next step for me would be to run the CLI rt in debug mode and

check that the commandline arguments are being passed in correctly.
It may be that you need to do some more escaping to have it work.

Ken

On Fri, Jul 06, 2007 at 07:43:25AM -0700, Jeff Stark wrote:

When I remove the parenthesis and try this I get the following:

[jstark@server obj]# /opt/rt3/bin/rt list -i ‘CF.{Severity Level} =
“Sev 3”’
rt: Invalid query: ‘’.
Invalid query: ‘’.

[jstark@server obj]# /opt/rt3/bin/rt list -i “CF.{Severity Level} =
‘Sev 3’”
rt: Invalid query: ‘’.
Invalid query: ‘’.

-Stark

-----Original Message-----
From: Kenneth Marshall [mailto:ktm@rice.edu]
Sent: Friday, July 06, 2007 10:18 AM
To: Jeff Stark
Cc: Kevin Falcone; RT Users
Subject: Re: [rt-users] RT CLI and Custom Fields

Why are you putting the value in parentheses? The simple string in
single quotes should work.

Ken

On Fri, Jul 06, 2007 at 07:10:59AM -0700, Jeff Stark wrote:

I just tried very similar to what you have Kevin, still no luck.

[jstark@server obj]# /opt/rt3/bin/rt list -i ('CF.{Severity Level}

=

“Sev 3”‘)
-bash: syntax error near unexpected token `(’

  • Stark

-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of
Kevin

Falcone
Sent: Thursday, July 05, 2007 3:59 PM
To: RT Users
Subject: Re: [rt-users] RT CLI and Custom Fields

On Jul 5, 2007, at 3:16 PM, Jeff Stark wrote:

has anyone successfully used the CLI to query RT Custom fields?

I

found a few posts, but with no responses.

Here is an example:

/opt/rt3/bin/rt list -i (‘CF.{Severity Level}’ = ‘Sev 3’")

This works fine for me

./bin/rt ls -i ‘CF.{foo} = “bar”’

-kevin


The rt-users Archives

Community help: http://wiki.bestpractical.com Commercial support:
sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly
Media.

Buy a copy at http://rtbook.bestpractical.com


The rt-users Archives

Community help: http://wiki.bestpractical.com Commercial support:
sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly
Media.
Buy a copy at http://rtbook.bestpractical.com

Hi,

I’m using RT 3.6.4, which I had installed using the ubuntu repositiries. I’m
using mysql as the backend DBMS. I have a custom field “Month of application”,
which I want to set while creating tickets. The queue I want to create
tickets in has this custom field as one of its fields.

The record for this custom field in the CustomFields table has an id = 31

I found a message on the mailing list saying that editing requires you to give the id,
so I tried:

rt create -t ticket set Queue=“Applications” CF-31=“April, 2008”

Invalid custom field name (31)

Ticket 3620 created.

I also tried using the following methods, but none seems to work:

rt create -t ticket set Queue=“Applications” CF.{“Month of application”}=“April, 2008”

rt create -t ticket set Queue=“Applications” ‘CF.{Month of application}’=“April, 2008”

rt create -t ticket set Queue=“Applications” CF-{“Month of application”}=“April, 2008”

Each time I got a message like:

rt: edit: Unrecognised argument ‘CF-{“Month of application”}=August, 2007’.
rt: For help, run ‘rt help create’.
rt: For help, run ‘rt help ticket’.

I checked the source of the rt command line. It seems to be expecting a string without
spaces as the field matching the pattern - [a-zA-Z][a-zA-Z0-9_-]* so it seems to me that
if there is a way to assign custom fields having spaces in them from the CLI, there should
be some way to identify the custom field without supplying spaces. Any comments,
Jesse, Ruslan, Kenneth, anyone?

Regards,
Terence.

Hi,

I’m using RT 3.6.4, which I had installed using the ubuntu
repositiries. I’m
using mysql as the backend DBMS. I have a custom field “Month of
application”,
which I want to set while creating tickets. The queue I want to create
tickets in has this custom field as one of its fields.

We’ve fixed a bunch of bugs related to CFs and the commandline in
3.6.5 and 3.6.6…It’s worth giving RT 3.6.6 a shot.

-jesse

PGP.sig (186 Bytes)