How can I get the value from a custom field from the command line

Hello,

I am trying to get the value of a custom field from a specified user.

I can get the normal details with the command “rt show user/22”.

But I would like to retrieve the current value (or lack thereof) of a
custom field that I created (simple text field). How can I do this?

If this is not possible using the API is there perhaps another way? I
tried getting directly from the database. The only problem is that when
you remove the value the latest value is still present in the ‘
ObjectCustomFieldValues’ table. I currently have a query that gets the
latest value from this table.

Kind regards,

Hans Vos

Hello,

I have found that you can set the custom field value for a ticket with
the following command:

rt edit -t ticket [ID] set CF-[ID]=‘value’

Where the first ID is the ticket number and second ID is the number of
the custom field.

However you cannot use the same syntax to retrieve the value, like:

rt show -t ticket -f CF-[ID] [ID]

Where the first ID is the number of the custom field and the second ID
is the ticket number.

However, it does work when you use the custom field name instead of the
ID, like:

rt show -t ticket -f CF-[Name] [ID]

Is this a bug?

Met vriendelijke groet / Best regards,

Hans Vos

System Administrator

E h.vos@drecomm.nl

T 050-577 5822

drecomm

Vestiging Groningen

Hoendiep 208 T +31 (0)50 577 58 22 Bekijk onze actuele projecten
9745 ED Groningen F +31 (0)50 577 58 23 www.drecomm.nl
http://www.drecomm.nl

Op 12-9-2012 22:30, Hans Vos schreef:

I have found that you can set the custom field value for a ticket with
the following command:

rt edit -t ticket [ID] set CF-[ID]=‘value’

Where the first ID is the ticket number and second ID is the number of
the custom field.

You can use the CF Name instead of ID just fine above. If it contains
any special characters, you’ll need to use CF.{Name Here} syntax, and of
course quote it properly for your shell.

Names are preferred to IDs in almost all cases of user interaction.

However you cannot use the same syntax to retrieve the value, like:

rt show -t ticket -f CF-[ID] [ID]

You’re not expected to know CF numeric IDs, so no, this doesn’t work.

However, it does work when you use the custom field name instead of the
ID, like:

rt show -t ticket -f CF-[Name] [ID]

Is this a bug?

No.