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

Kevin Falcone falcone at bestpractical.com
Thu Sep 1 09:12:34 EDT 2011


On Thu, Sep 01, 2011 at 12:05:57PM +1000, Stuart Browne wrote:
> > 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

> /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
> --------
> RT Training Sessions (http://bestpractical.com/services/training.html)
> *  Chicago, IL, USA  September 26 & 27, 2011
> *  San Francisco, CA, USA  October 18 & 19, 2011
> *  Washington DC, USA  October 31 & November 1, 2011
> *  Melbourne VIC, Australia  November 28 & 29, 2011
> *  Barcelona, Spain  November 28 & 29, 2011
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110901/4ebd14ba/attachment.sig>


More information about the rt-users mailing list