[rt-users] Matching Custom Field to DB Entry

Alex Peters alex at peters.net
Thu Jul 31 20:32:21 EDT 2014


This functionality could be achieved using a scrip which detects the
specific point at which you want the population to occur (perhaps at ticket
creation, or when another specific custom field is set or changed), and
then uses standard Perl code to connect to the database, issue the
appropriate SQL and write the result to your custom field.

If the only means of accessing your database's data is via SQL, you'd
probably want to look into using DBI, the standard Perl solution for
working with databases:

https://metacpan.org/pod/DBI

and the process would involve connecting to the database, preparing an SQL
query, executing it, and retrieving the result from the structure returned.

If your database offers some form of web service for retrieval of data,
look into WWW::Mechanize:

https://metacpan.org/pod/WWW::Mechanize

At any rate, once your scrip has access to the necessary data from the
database, writing it to one of the ticket's custom fields would be done
like this:

$self->TicketObj->AddCustomFieldValue( Field => 'XXX', Value => YYY );

where XXX is the name of your custom field and YYY is the data from the
database.


On 1 August 2014 06:23, Scott McCall <scott.mccall at compfitness.com> wrote:

> Hello,
>
>
>
> I apologize if this is not the correct way of posting questions, I’m still
> relatively new to RT.
>
>
>
> Just looking for some advice/guidance on the best way to use RT to
> populate a custom field from a database entry.
>
>
>
> We currently have a “extract info” template that goes through and extracts
> info from an incoming email and populates our custom fields with that
> info.  That works great.
>
>
>
> What we’re looking to do is to set up a database, and cross reference the
> extracted info with the DB to populate another CF.
>
>
>
> The example would be: a street address is extracted from an email (regex),
> and we then check the database to find out what delivery route this address
> is associated with, then automatically populate the “route” CF if it find a
> match.
>
>
>
> Any assistance would be greatly appreciated!
>
>
>
>
>
> *Scott*
>
> --
> RT Training - Boston, September 9-10
> http://bestpractical.com/training
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20140801/6b5458ab/attachment.htm>


More information about the rt-users mailing list