[rt-users] Append Data to CustomFields

TheHoboKing demon_eyes_kyoms at hotmail.com
Wed May 30 13:53:37 EDT 2012


Hi Kenneth,

Thank you for the reply and my apologies for the delay, I've been busy with
other projects.

I mentioned the TimeWorked field because that's how I'd like my other 'time'
CFs to behave but here's what I'm trying to achieve in more details.

I have two CFs: Emergency Hours | Schedule Hours
CFs type is 'Enter one value'

On ticket updates (users will most likely only update tickets from the WebUI
via comment/reply action), I'd like those CFs to behave as followed:

On update, the CFs should show no value. If my user(s) enter a value and
update the ticket, the value should be added to the previous value (users
will only be inputting integers).

i.e.:
Emergency Hours current value = 10
Users Update the ticket and adds 15 in the Emergency Hours
Emergency Hours should now display 25

Is there a way to achieve this via script or more in dept RT customization?

-I've tried to create another TimeWorked field but TimeWorked seems to be
all over the place and I couldn't identify the proper sections to add/modify
in order to 'duplicate' TimeWorked.

-I was also thinking if it may be possible to do it via scrip by;
OnComment or OnTransaction
Reading the value of 'Emergency Hours'
Storing the value in a temporary variable
Adding the new value to the old value. .i.e: Emergency Hours =
TemporaryEmergencyHoursTotal + EmergencyHours

-I also thought I could simply create another CF called
'EmergencyHoursTotal' and store the total there BUT then, on ticket display
only 'EmergencyHoursTotal' should be visible and 'Emergency Hours' should be
hidden, on ticket update only 'Emergency Hours' should be visible and
'EmergencyHoursTotal' should be hidden.

I read hiding/displaying specific CF can be achieved via the
MassageCustomFields callback but I don't find much information on how to
code my MassageCustomFields. This is the most informative code I've found in
regards to it.

http://cpansearch.perl.org/src/RUZ/RT-Extension-CustomField-HideEmptyValues-0.01/html/Callbacks/CustomField-HideEmptyValues/Elements/ShowCustomFields/MassageCustomFields

Sorry for my long long post, let me know if I should open a new tread in
regards to the MassageCustomFields info.

Thank you again!




Kenneth Crocker-2 wrote:
> 
> HoboKing,
> 
> You could create a CF with SeeCF rights only to Users and then write a
> scrip so that when the TimeWorked field is updated, the scrip subtracts
> the
> old value from the new value and then adds that result to the CF.
> You could also add a condition to check the date and if it is month-end or
> something you could move the final "TomeWorked" value to a Month-end Time
> CF and then zero out the contiguos one.
> That way, you won't run into problems of some user entering a non-inter
> type value into the field. You might want to grant "ModifyCF" to the
> SuperUSer or some management group of users so they can override the value
> when necessary.
> It all depends on what you want to accomplish.
> TimeWorked is already designed to receive integers. So all you really need
> is a CF to act as a monthly or yearly, etc. accumulator, along with a
> routine to zero out at the end of that cycle.
> The best way is to write a cronjob to run through all tickets on whatever
> cycle you want to accumulate and have that routine do the
> accumulate/move/zero work. That way you get ALL tickets updated
> consistently, not just the ones that were updated in a given cycle.
> 
> Hope this helps.
> 
> Kenn
> 
> On Mon, May 28, 2012 at 11:44 AM, TheHoboKing
> <demon_eyes_kyoms at hotmail.com>wrote:
> 
>>
>> Hi,
>>
>> I'm still quite new at RT and was wondering if there's a way to have
>> appendable/updatable CustomFields like the TimeWorked field?
>>
>> Whenever I update a ticket, the TimeWorked field is blank, any value
>> (digits) I add will automatically be added to the old value, it'll make a
>> simple addition.
>>
>> How can I do the same with CustomFields? Either via the webUI, scrip or
>> back-end (Update.html ? ModifyAll.html?)
>>
>> I'm running RT 4.0.5
>>
>> Thank you!
>> --
>> View this message in context:
>> http://old.nabble.com/Append-Data-to-CustomFields-tp33920988p33920988.html
>> Sent from the Request Tracker - User mailing list archive at Nabble.com.
>>
>>
> 
> 
-- 
View this message in context: http://old.nabble.com/Append-Data-to-CustomFields-tp33920988p33933640.html
Sent from the Request Tracker - User mailing list archive at Nabble.com.




More information about the rt-users mailing list