[rt-users] Unique custom fields for assets

Seever, Kenny Kenny.Seever at mgpingredients.com
Tue Mar 15 12:34:57 EDT 2016


Kyle,

Thanks for the reply.  If possible would you be willing to share what you have?  This will be something I've never attempted so need all the help I can get.

Thanks again,

Kenny

From: Kyle Dippery [mailto:kyle.dippery at uky.edu]
Sent: Monday, March 14, 2016 8:34 AM
To: rt-users at lists.bestpractical.com
Cc: Seever, Kenny <Kenny.Seever at mgpingredients.com>
Subject: Re: [rt-users] Unique custom fields for assets

Kenny,

I haven't looked at RT 4.4 yet, so perhaps it's built in there, but it wasn't in RT 4.2.

What you will need to do, if it isn't there already, is create your own extension to the Asset.pm module, call it Asset_Local.pm, and add code there to check for uniqueness and auto-populate the field.  The Create {} subroutine is the one you'll most likely want to override.

One gotcha that I remember (I did this about a year ago) is that I needed to know the number of the custom field; I couldn't figure out how to search the $args{} array for the field by name.  That being our most critical custom field, though, it made sense to create it first so it would be "CustomField-1".

I'm reluctant to post my actual code, because it's crappy and I don't want to release bad code into the wild, but if you'd like to see it I can sanitize it some and share it.

Cheers,
Kyle
On 03/11/2016 11:38 AM, Seever, Kenny wrote:
Hello,

I am working on evaluating using the Assets module in RT to manage our equipment, but haven't been able to figure out if there is a way to make a field unique.  All of our equipment has a 5 digit asset number (2XXXX) that is unique.  I need to be able to add a field that makes sure that each number is only used once.  Ideally it would auto populate with the next number when a new asset is added, but that may be asking for too much.  Is there build in functionality for any of this that I've missed in the documentation?

Thanks in advance,

Kenny



--

Kyle Dippery

Engineering Computing Services

219 RMB

859-257-1346
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20160315/7a1bef61/attachment.htm>


More information about the rt-users mailing list