[rt-users] Link values to - use multiple CF values

Stuart Browne stuart.browne at ausregistry.com.au
Wed Aug 31 22:05:57 EDT 2011


> 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 ;)

Stuart



More information about the rt-users mailing list