[rt-users] RT CLI and Custom Fields

Kenneth Marshall ktm at rice.edu
Fri Jul 6 12:14:42 EDT 2007


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.

Ken

On 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 at 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 at 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 at server obj]# /opt/rt3/bin/rt list -i 'CF.{Severity Level} = 
> > > "Sev 3"'
> > > rt: Invalid query: ''.
> > > Invalid query: ''.
> > > 
> > > [jstark at 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 at 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 at 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 at lists.bestpractical.com
> > > > [mailto:rt-users-bounces at 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
> > > > _______________________________________________
> > > > 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
> > > > 
> > > > _______________________________________________
> > > > 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