Sorting custom fields

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi there,
maybe this is stupid but is there a quick way of re-sorting custom fields?

Thanks,
Giuseppe


Giuseppe Sollazzo
Senior Systems Analyst
Computing Services
Information Services
St. George’s, University Of London
Cranmer Terrace
London SW17 0RE

Email: gsollazz@sgul.ac.uk
Direct Dial: +44 20 8725 5160
Fax: +44 20 8725 3583

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOu+RrAAoJEAqigArPBfJXNOQH/jdKeK/eqbuVnwD2aVmjpsAQ
Fim6Z1yoojPuGmz/yPEVoxhDuZy7qwbCme7+pV2T6/miwUShJUJr/QflvK9pxxyQ
W03MlQuuhlrFrka9atmDXcGzUM4hd7bZL3d3npUPtAfb8+ky2kP5+eBzMQqQeAXU
gPnmN2jcpcMTPOcuFJVfp6I1r9wxzE+bEOo3frma5RpyEifkHDPopqldf6KRwMzM
0r/3SjN01bB9L2VgcxcT26HZYqi43Q4v4fq28EpzzFJFIAN3lipVPs1b8Q0cS4d8
9otLY5dTOQjiI28VWY+y1jKJeOa227EWdqyWWypAKJEU7nrk0Mk6yg0S4jLAb2A=
=bEKW
-----END PGP SIGNATURE-----

Giuseppe,

Are you talking about hoe the VALUES appear or the way the Fields
themselves appear on a ticket page?

Kenn
LBNLOn Thu, Nov 10, 2011 at 6:49 AM, Giuseppe Sollazzo gsollazz@sgul.ac.ukwrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi there,
maybe this is stupid but is there a quick way of re-sorting custom fields?

Thanks,
Giuseppe



Giuseppe Sollazzo
Senior Systems Analyst
Computing Services
Information Services
St. George’s, University Of London
Cranmer Terrace
London SW17 0RE

Email: gsollazz@sgul.ac.uk
Direct Dial: +44 20 8725 5160
Fax: +44 20 8725 3583

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOu+RrAAoJEAqigArPBfJXNOQH/jdKeK/eqbuVnwD2aVmjpsAQ
Fim6Z1yoojPuGmz/yPEVoxhDuZy7qwbCme7+pV2T6/miwUShJUJr/QflvK9pxxyQ
W03MlQuuhlrFrka9atmDXcGzUM4hd7bZL3d3npUPtAfb8+ky2kP5+eBzMQqQeAXU
gPnmN2jcpcMTPOcuFJVfp6I1r9wxzE+bEOo3frma5RpyEifkHDPopqldf6KRwMzM
0r/3SjN01bB9L2VgcxcT26HZYqi43Q4v4fq28EpzzFJFIAN3lipVPs1b8Q0cS4d8
9otLY5dTOQjiI28VWY+y1jKJeOa227EWdqyWWypAKJEU7nrk0Mk6yg0S4jLAb2A=
=bEKW
-----END PGP SIGNATURE-----


RT Training Sessions (http://bestpractical.com/services/training.html)

  • Barcelona, Spain November 28 & 29, 2011

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Giuseppe,

Are you talking about hoe the VALUES appear or the way the Fields
themselves appear on a ticket page?

Hi Kenneth,
the order of the fields themselves.
I know you can give a sort order for the values within the interface,
so I was expecting something similar to be available for Fields order.
The only way to do it seems to be swapping them around.
Any other possibility?

Thanks,
Giuseppe

Kenn LBNL

Hi there, maybe this is stupid but is there a quick way of
re-sorting custom fields?

Thanks, Giuseppe


RT Training Sessions
(http://bestpractical.com/services/training.html)

  • Barcelona, Spain November 28 & 29, 2011

-------- RT Training Sessions
(http://bestpractical.com/services/training.html) * Barcelona,
Spain ? November 28 & 29, 2011


Giuseppe Sollazzo
Senior Systems Analyst
Computing Services
Information Services
St. George’s, University Of London
Cranmer Terrace
London SW17 0RE

Email: gsollazz@sgul.ac.uk
Direct Dial: +44 20 8725 5160
Fax: +44 20 8725 3583

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOwVCDAAoJEAqigArPBfJXAzsH/3fcawXwyosVR9yPP65qky2R
PpgMozygRBcoJnlh1Ic6cURrcXUfhn+xDYtrtmHzD4W8Uk+bgFWNd7bSx+14/SJy
I5WmqpLo1Cv79vY2OWDe/DQ1eCxS45lSMk0CtjqbZM0ljWjc00D+oFU+wbBOoska
1TJH9lXueZ7ckeuC35v/9tbuZBxQgwfcFk2IRTxQZkuMM2Y5O6pdVp8+y0uXGprC
ECSsTd8F1LT0ymajsoUUJYM0ymZno0wyTbW0fsTsHjZKsjQxJcqVHo8KZ2SKY+t7
gP4nXgGgE2yMk5ZXeEudtUdMUAH3waUSCM61oDMgnvKVoB1bWMZWmW9sR/AsXF4=
=y21q
-----END PGP SIGNATURE-----

Giuseppe,

As far as I know, you can only modify the sequence under “Ticket Custom
Fields” when Configuring a Queue. So that all tickets in the same Queue see
the Cf’s in the same sequence. That’s about the extent of my knowledge.

Kenn
LBNLOn Mon, Nov 14, 2011 at 9:31 AM, Giuseppe Sollazzo gsollazz@sgul.ac.ukwrote:

**

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 14/11/11 17:24, Kenneth Crocker wrote:

Giuseppe,

Are you talking about hoe the VALUES appear or the way the Fields
themselves appear on a ticket page?

Hi Kenneth,
the order of the fields themselves.
I know you can give a sort order for the values within the interface,
so I was expecting something similar to be available for Fields order.
The only way to do it seems to be swapping them around.
Any other possibility?

Thanks,
Giuseppe

Kenn LBNL

On Thu, Nov 10, 2011 at 6:49 AM, Giuseppe Sollazzo <gsollazz@sgul.ac.uk mailto:gsollazz@sgul.ac.uk gsollazz@sgul.ac.uk> wrote:

Hi there, maybe this is stupid but is there a quick way of
re-sorting custom fields?

Thanks, Giuseppe


RT Training Sessions
(http://bestpractical.com/services/training.html)

  • Barcelona, Spain November 28 & 29, 2011

-------- RT Training Sessions
(http://bestpractical.com/services/training.html) * Barcelona,
Spain ? November 28 & 29, 2011



Giuseppe Sollazzo
Senior Systems Analyst
Computing Services
Information Services
St. George’s, University Of London
Cranmer Terrace
London SW17 0RE

Email: gsollazz@sgul.ac.uk
Direct Dial: +44 20 8725 5160
Fax: +44 20 8725 3583

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOwVCDAAoJEAqigArPBfJXAzsH/3fcawXwyosVR9yPP65qky2R
PpgMozygRBcoJnlh1Ic6cURrcXUfhn+xDYtrtmHzD4W8Uk+bgFWNd7bSx+14/SJy
I5WmqpLo1Cv79vY2OWDe/DQ1eCxS45lSMk0CtjqbZM0ljWjc00D+oFU+wbBOoska
1TJH9lXueZ7ckeuC35v/9tbuZBxQgwfcFk2IRTxQZkuMM2Y5O6pdVp8+y0uXGprC
ECSsTd8F1LT0ymajsoUUJYM0ymZno0wyTbW0fsTsHjZKsjQxJcqVHo8KZ2SKY+t7
gP4nXgGgE2yMk5ZXeEudtUdMUAH3waUSCM61oDMgnvKVoB1bWMZWmW9sR/AsXF4=
=y21q
-----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Giuseppe,

Are you talking about hoe the VALUES appear or the way the Fields
themselves appear on a ticket page?

Hi Kenneth,
the order of the fields themselves.
I know you can give a sort order for the values within the interface,
so I was expecting something similar to be available for Fields order.
The only way to do it seems to be swapping them around.
Any other possibility?

Custom perl script that talks to API or direct SQL on
ObjectCustomFields table. It’s better to use fresh 3.8 or 4.0. Here is
SQL to see the current state:

SELECT cf.Name, q.Name, ocf.SortOrder FROM CustomFields cf JOIN
ObjectCustomFields ocf ON ocf.CustomField = cf.id LEFT JOIN Queues q
ON ocf.ObjectId = q.id WHERE cf.LookupType = ‘RT::Queue-RT::Ticket’
AND (q.Name IS NULL OR q.Name = ‘Blocks’) ORDER BY cf.LookupType ASC,
ocf.SortOrder ASC;

Thanks,
Giuseppe

Kenn LBNL

Hi there, maybe this is stupid but is there a quick way of
re-sorting custom fields?

Thanks, Giuseppe


RT Training Sessions
(http://bestpractical.com/services/training.html)

  • Barcelona, Spain November 28 & 29, 2011

-------- RT Training Sessions
(http://bestpractical.com/services/training.html) * Barcelona,
Spain ? November 28 & 29, 2011



Giuseppe Sollazzo
Senior Systems Analyst
Computing Services
Information Services
St. George’s, University Of London
Cranmer Terrace
London SW17 0RE

Email: gsollazz@sgul.ac.uk
Direct Dial: +44 20 8725 5160
Fax: +44 20 8725 3583

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOwVCDAAoJEAqigArPBfJXAzsH/3fcawXwyosVR9yPP65qky2R
PpgMozygRBcoJnlh1Ic6cURrcXUfhn+xDYtrtmHzD4W8Uk+bgFWNd7bSx+14/SJy
I5WmqpLo1Cv79vY2OWDe/DQ1eCxS45lSMk0CtjqbZM0ljWjc00D+oFU+wbBOoska
1TJH9lXueZ7ckeuC35v/9tbuZBxQgwfcFk2IRTxQZkuMM2Y5O6pdVp8+y0uXGprC
ECSsTd8F1LT0ymajsoUUJYM0ymZno0wyTbW0fsTsHjZKsjQxJcqVHo8KZ2SKY+t7
gP4nXgGgE2yMk5ZXeEudtUdMUAH3waUSCM61oDMgnvKVoB1bWMZWmW9sR/AsXF4=
=y21q
-----END PGP SIGNATURE-----


RT Training Sessions (http://bestpractical.com/services/training.html)

  • Barcelona, Spain — November 28 & 29, 2011

Best regards, Ruslan.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Kennet,
yep, that makes sense. My question, very badly worded, is whether it’s
possible to re-sort the fields once you’ve already added them to a
queue. But never mind, I’ll do it with swapping.

Best,
GiuseppeOn 14/11/11 17:50, Kenneth Crocker wrote:

Giuseppe,

As far as I know, you can only modify the sequence under “Ticket
Custom Fields” when Configuring a Queue. So that all tickets in
the same Queue see the Cf’s in the same sequence. That’s about the
extent of my knowledge.

Kenn LBNL

On Mon, Nov 14, 2011 at 9:31 AM, Giuseppe Sollazzo <gsollazz@sgul.ac.uk mailto:gsollazz@sgul.ac.uk> wrote:

On 14/11/11 17:24, Kenneth Crocker wrote:

Giuseppe,

Are you talking about hoe the VALUES appear or the way the
Fields

themselves appear on a ticket page?

Hi Kenneth, the order of the fields themselves. I know you can give
a sort order for the values within the interface, so I was
expecting something similar to be available for Fields order. The
only way to do it seems to be swapping them around. Any other
possibility?

Thanks, Giuseppe

Kenn LBNL

On Thu, Nov 10, 2011 at 6:49 AM, Giuseppe Sollazzo <gsollazz@sgul.ac.uk mailto:gsollazz@sgul.ac.uk mailto:gsollazz@sgul.ac.uk mailto:gsollazz@sgul.ac.uk> wrote:

Hi there, maybe this is stupid but is there a quick way of

re-sorting custom fields?

Thanks, Giuseppe


RT Training Sessions
(http://bestpractical.com/services/training.html) * Barcelona,
Spain November 28 & 29, 2011

-------- RT Training Sessions

(http://bestpractical.com/services/training.html) *
Barcelona,

Spain ? November 28 & 29, 2011

-------- RT Training Sessions
(http://bestpractical.com/services/training.html) * Barcelona,
Spain ? November 28 & 29, 2011


Giuseppe Sollazzo
Senior Systems Analyst
Computing Services
Information Services
St. George’s, University Of London
Cranmer Terrace
London SW17 0RE

Email: gsollazz@sgul.ac.uk
Direct Dial: +44 20 8725 5160
Fax: +44 20 8725 3583

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOwjswAAoJEAqigArPBfJXL7cIAJYrNW8U18XBQC73d2v+2bdZ
4unD1NftReWNZ1QFzDfulwPbJsA3w1BQAwiQHMgGasZKCa/1ueYG29e3dthQHWRd
cGZx/yw4qRj0x+fWUpp8wndoeiHoG9M2ylMHeo+B6jypmnJ5EUsm9Yr2bHnSJcdm
UpmhaCUvugQn2CeVi8HtHBDSCYUFa68+owavnXvuxfbuDQyc3yJrScvxBN3a7Wer
Q/w5YDEEIaT0flmVFNwdNRkBQ/sMyhgEIB015j0w4CxNKUpfmy9Ghu9A2f969MEc
HYGRQIllVpQD3c1y82pJmfZ2bZr3+EdMpPec8Cwg19hlfxWOpFURNfLFxSmTspg=
=r/xn
-----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanks Ruslan,
I’ll see if this doesn’t overcomplicate things.

GiuseppeOn 14/11/11 18:09, Ruslan Zakirov wrote:

ustomFields ocf ON ocf.CustomField = cf.id LEFT JOIN Queues q ON
ocf.ObjectId = q.id WHERE cf.LookupType = ‘RT::Queue-RT::Ticket’
AND (q.Name IS NULL OR q.Name = ‘Blocks’) ORDER BY cf.LookupType
ASC, ocf.SortOrder ASC;


Giuseppe Sollazzo
Senior Systems Analyst
Computing Services
Information Services
St. George’s, University Of London
Cranmer Terrace
London SW17 0RE

Email: gsollazz@sgul.ac.uk
Direct Dial: +44 20 8725 5160
Fax: +44 20 8725 3583

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOwjtPAAoJEAqigArPBfJXgSQH/iJfiBVMxUvofXN6aJsO2GJi
qgJ9yE57ylSYaOulctEDkYbXzR0t1RudFZnDhCdDM9aVvl0qIB6BDp4v5kSaueNd
4p1vR//oYQKkR6K/wxXYoeqbsTouy2lU414O9fZ2PWrm9D0aNpfrErLJ5ysRtp0+
W5J3L/nAPWMghB+xWSm5EH43ldPbJJeH/grdLFhcgelBo5uwTeK9relxlrLcnj9e
/z9Nl7K7uGiw2bGkz4+ELk84V3Wr+e/TGziPBsfzn/3jSyvK1IETtCzg4s4PfEe4
SErGXIxCF+VQ6BfdZYslwKkDMA5XJ1MeVm0tLFZyV/y8F33uRR43C5ZhB7lt+YA=
=3vhB
-----END PGP SIGNATURE-----

My collection of queues and ticket custom fields finally got unwieldy
enough to really want something simpler to reorder the fields. Not that it
isn’t fun to hit Move Up and Move Down a thousand times… :wink:

Run this script with --dump. Edit the resulting yaml file. If you’re
using vim, this generally consists of hitting dd and p a few times here and
there to get things to your liking. Don’t change the format, just reorder
the lines and save the yaml file.

Run the script with --load. This will read the yaml file and make custom
fields appear in the same order that they are in the yaml file you just
edited.

All reads and writes are done through the RT API, so no perilous direct sql
calls or anything.

Andy Harrison
public key: 0x67518262