Link values to - use multiple CF values

Hi,

I was wondering if anybody knew of any extensions that could create a link from more than one custom fields combined together.

Situation:

I have a custom field with a mingle card number. Link-to value works fine for a single mingle project, project name is in the path. Sadly, the card numbers are not unique between projects.

As such, I’ve created a second custom field with the project name in it. For automated card creation, this works fine. However, the link-to value is still hard-wired to the single project.

I thought maybe I could use a search-style CF{name} to get the value of another custom field, but looking at the documentation in ObjectCustomFieldValue_Overlay.pm seems to indicate that it isn’t possible.

Does anybody know of an extension or other ‘patch’ to allow the inclusion of multiple CF values within the link-to URL’s? Or do I need to create my own internal jump-to page to do the mapping externally?

Stuart J. Browne
Senior Unix Administrator, Network Administrator
AusRegistry Pty Ltd
Level 8, 10 Queens Road
Melbourne. Victoria. Australia. 3004.
Ph: +61 3 9866 3710
Fax: +61 3 9866 1970
Email: stuart.browne@ausregistry.com.au
Web: www.ausregistry.com.au

The information contained in this communication is intended for the named recipients only. It is subject to copyright and may contain legally privileged and confidential information and if you are not an intended recipient you must not use, copy, distribute or take any action in reliance on it. If you have received this communication in error, please delete all copies from your system and notify us immediately.

I have a custom field with a mingle card number. Link-to value works fine for a single mingle project, project name is in the path. Sadly, the card numbers are not unique between projects.
As such, I’ve created a second custom field with the project name in it. For automated card creation, this works fine. However, the link-to value is still hard-wired to the single project.
I thought maybe I could use a search-style CF{name} to get the value of another custom field, but looking at the documentation in ObjectCustomFieldValue_Overlay.pm seems to indicate that it isn’t possible.
Does anybody know of an extension or other ‘patch’ to allow the inclusion of multiple CF values within the link-to URL’s? Or do I need to create my own internal jump-to page to do the mapping externally?

I’d just do a custom display of that Custom Field and build the link
myself, rather than trying to extend the link to functionality.

You’ll probably find the ShowComponentName callback useful

-kevin

I’d just do a custom display of that Custom Field and build the link
myself, rather than trying to extend the link to functionality.

You’ll probably find the ShowComponentName callback useful

Kevin,

Thanks for the suggestion.

This is what I ended up with.

/opt/rt3/local/html/Callbacks/MingleCardNumberLink/Elements/ShowCustomFields/ShowComponentName:
<%INIT>

Bail if the ticket doesn’t have a value in the ‘Mingle Card Number’ CF.

if ($CustomField->Name eq ‘Mingle Card Number’) {

Construct URL to Mingle

    my $MingleCard    = $Object->FirstCustomFieldValue('Mingle Card Number');
    if (defined $MingleCard && $MingleCard) {
            my $MingleProject = $Object->FirstCustomFieldValue('Mingle Project');
            if ($MingleProject eq '') {
                    $MingleProject = 'dnr';
            }
            printf("<a target='_new' href='http://URL/projects/%s/cards/%s'>(Click)</a> - http://URL/projects/%s/cards/", $MingleProject, $MingleCard, $MingleProject);
    }

}
</%INIT>
<%ARGS>
$Name => undef
$CustomField => undef
$Object => undef
</%ARGS>

It has one limitation sadly, I can’t stop RT from printing the value of the custom field (thus the weird ‘(Click) - …’), but this is enough for now :wink:

Stuart

I’d just do a custom display of that Custom Field and build the link
myself, rather than trying to extend the link to functionality.

You’ll probably find the ShowComponentName callback useful

Thanks for the suggestion.

This is what I ended up with.

I actually meant that you should use that callback to change what
component is used for display. You’re passed $Name, assign to it by
reference (say ShowCustomFieldCustomLink) if you’re in the right
custom field and then write your custom code into the
ShowCustomFieldCustomLink element in local/

That callback isn’t intended as a place to printf from

-kevin

-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-
bounces@lists.bestpractical.com] On Behalf Of Kevin Falcone
Sent: Thursday, 1 September 2011 11:13 PM
To: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Link values to - use multiple CF values

I’d just do a custom display of that Custom Field and build the link
myself, rather than trying to extend the link to functionality.

You’ll probably find the ShowComponentName callback useful

Thanks for the suggestion.

This is what I ended up with.

I actually meant that you should use that callback to change what
component is used for display. You’re passed $Name, assign to it by
reference (say ShowCustomFieldCustomLink) if you’re in the right
custom field and then write your custom code into the
ShowCustomFieldCustomLink element in local/

That callback isn’t intended as a place to printf from

Ahh, righteo. Will look at it again if I have some time :wink:

Stuart

I’d just do a custom display of that Custom Field and build the link
myself, rather than trying to extend the link to functionality.

You’ll probably find the ShowComponentName callback useful

Thanks for the suggestion.

This is what I ended up with.

I actually meant that you should use that callback to change what
component is used for display. You’re passed $Name, assign to it by
reference (say ShowCustomFieldCustomLink) if you’re in the right
custom field and then write your custom code into the
ShowCustomFieldCustomLink element in local/

That callback isn’t intended as a place to printf from

Ahh, righteo. Will look at it again if I have some time :wink:

Ok, now that you’ve said that, the code read makes more sense (not a programmer! So very much not a programmer!).

Ended up with:

— /opt/rt3/local/html/Callbacks/MingleCardNumberLink/Elements/ShowCustomFields/ShowComponentName
<%INIT>
if ($CustomField->Name eq ‘Mingle Card Number’) {
$$Name = ‘DisplayMingleCardLink’;
}
</%INIT>
<%ARGS>
$Name => undef
$CustomField => undef
$Object => undef
</%ARGS>

— /opt/rt3/local/html/Elements
% my $output = $Object->Content;
%
% my $MingleCard = $Object->Content;
% if (defined $MingleCard && $MingleCard) {
% my $MingleProject = $Object->Object->FirstCustomFieldValue(‘Mingle Project’);
% if ($MingleProject eq ‘’) {
% $MingleProject = ‘dnr’;
% }
% $output = sprintf(“%s”, $MingleProject, $MingleCard, $MingleCard);
% }
<%$output|n%>
<%ARGS>
$Object => undef
</%ARGS>

The documentation is fairly vague on custom callbacks. Thanks to Using Callbacks in RT | runPCrun - IT Support for London for the clue as to where the custom callback should be located.

Stuart

Damn, missed the path properly:

— /opt/rt3/local/html/Callbacks/MingleCardNumberLink/Elements/ShowCustomFields/ShowComponentName
<%INIT>
if ($CustomField->Name eq ‘Mingle Card Number’) {
$$Name = ‘DisplayMingleCardLink’;
}
</%INIT>
<%ARGS>
$Name => undef
$CustomField => undef
$Object => undef
</%ARGS>

— /opt/rt3/local/html/Elements/DisplayMingleCardLink
% my $output = $Object->Content;
%
% my $MingleCard = $Object->Content;
% if (defined $MingleCard && $MingleCard) {
% my $MingleProject = $Object->Object->FirstCustomFieldValue(‘Mingle Project’);
% if ($MingleProject eq ‘’) {
% $MingleProject = ‘dnr’;
% }
% $output = sprintf(“%s”, $MingleProject, $MingleCard, $MingleCard);
% }
<%$output|n%>
<%ARGS>
$Object => undef
</%ARGS>

The documentation is fairly vague on custom callbacks. Thanks to Using Callbacks in RT | runPCrun - IT Support for London for the clue as to where the custom callback should be located.

The Customizing documentation should link to a page on callbacks

http://requesttracker.wikia.com/wiki/Customizing

-kevin

-----Original Message-----
Sent: Friday, 2 September 2011 10:26 AM

The documentation is fairly vague on custom callbacks. Thanks to
Using Callbacks in RT | runPCrun - IT Support for London for the clue as to where the custom
callback should be located.

The Customizing documentation should link to a page on callbacks

http://requesttracker.wikia.com/wiki/Customizing

-kevin

I read through that, but it wasn’t detailed enough for me to understand it on the first pass. I’ve used callbacks before like that page (overriding some behaviours on the Modify/Update ticket pages), but this stuff doesn’t really fit in to those nodes. The concept of creating a custom callback isn’t even mentioned let alone the path to put the callback content.

So just a bit lacking. I should get off my arse and expand that page. Maybe this weekend.

Stuart