[rt-users] rt-crontool - "increase" the value of a CF.

Bart bart at pleh.info
Wed Nov 23 13:57:41 EST 2011


Hi Yan,

I'll also have a look at the rt script and see if I can manage it using
that, thanks :)

-- Bart


Op 23 november 2011 19:50 schreef Yan Seiner <yan at seiner.com> het volgende:

> Wouldn't this work (snippet from a bigger script):
>
> # and set custom fields
> /opt/rt4/bin/rt edit ticket/${ticket} set 'CF.{contractor}'="${contractor}"
> /opt/rt4/bin/rt edit ticket/${ticket} set 'CF.{amount}'="${amount}"
>
> That's how I set custom fields.  You could get the value that way,
> increment it or whatever in a script, and then set it again.
>
>
>
> On Wed, November 23, 2011 10:23 am, Bart wrote:
> > Hi Kevin,
> >
> > Thanks for the reply,
> >
> > Guess I'll have to learn Perl a bit more then and experiment a little
> with
> > this.
> >
> > Will post the results once I've gained some progress.
> >
> > -- Bart
> >
> >
> > Op 23 november 2011 18:08 schreef Kevin Falcone
> > <falcone at bestpractical.com>het volgende:
> >
> >> On Wed, Nov 23, 2011 at 05:25:01PM +0100, Bart wrote:
> >> >    I've then created a simple rt-crontool command to see if I could
> >> find
> >> a ticket and if I could
> >> >    set a value when I found that ticket. This worked as well, below
> >> the
> >> result:
> >> >    /opt/rt4/bin/rt-crontool \
> >> >            --search RT::Search::FromSQL \
> >> >            --search-arg "status = 'open'" \
> >> >            --action RT::Action::SetPriority --action-arg 3 \
> >> >            --verbose
> >> >    So now for the question(s):
> >> >
> >> >      * First a simple one, how do I set a value for a custom field?
> >> >      * And the more difficult one, how do I increase a value instead
> >> of
> >> replacing it? (adding +
> >> >        or something like that doesn't seem to work)
> >> >
> >> >    Hopefully this is possible with the rt-crontool, if not then I'd
> >> like
> >> to hear your thoughts on
> >> >    how I'd be able to do the above in a different manner.
> >>
> >> Unfortunately, you'll need to write your own RT::Action to change the CF
> >>
> >> You could turn this into a pretty trivial perl script using the RT API
> >> and calling $tickets->FromSQL("status = 'open'") and then iterating
> >> the list to call AddCustomFieldValue
> >>
> >> -kevin
> >>
> >> --------
> >> RT Training Sessions (http://bestpractical.com/services/training.html)
> >> *  Barcelona, Spain — November 28 & 29, 2011
> >>
> >
> >
> > !DSPAM:4ecd3a6094962612618147!
> > --------
> > RT Training Sessions (http://bestpractical.com/services/training.html)
> > *  Barcelona, Spain ? November 28 & 29, 2011
> >
> > !DSPAM:4ecd3a6094962612618147!
> >
>
>
> --
> Pain is temporary. It may last a minute, or an hour, or a day, or a year,
> but eventually it will subside and something else will take its place. If
> I quit, however, it lasts forever.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20111123/d0965b64/attachment.htm>


More information about the rt-users mailing list