[rt-users] How do I make a custom field with values not equal to names ?

Al Joslin allen.joslin at gmail.com
Thu Jul 24 23:01:14 EDT 2014


Ah,

	I thought I'd have to use code before this was done

	Thanks, this'll be my intro into Scrip'ing

Al;


On Jul 24, 2014, at 10:55 PM, Alex Peters <alex at peters.net> wrote:

> I'd probably implement that as two separate custom fields:
> the Plan value, which is visible to and modifiable by the users;
> the dollar value, which is not visible to the users.
> I'd then build a scrip that fires on changes to the Plan value, and sets the dollar value accordingly using a lookup table within the scrip itself.
> 
> That scrip (or other subsequent scrips) would then have access to the dollar value without regard to the selected plan (although those scrips could still inspect the Plan value if needed).
> 
> Code like this should be close to achieving what I've described above:
> 
> use constant VALUE_FOR_PLAN => {
>   'Plan A' => 19.99,
>   'Plan B' => 29.99,
>   'Plan C' => 39.99,
> };
> 
> my $ticket = $self->TicketObj;
> my $plan = $ticket->FirstCustomFieldValue('Plan');
> $ticket->AddCustomFieldValue(
>   Field => 'dollar value',
>   Value => VALUE_FOR_PLAN->{$plan},
> );
> 
> 
> On 25 July 2014 12:44, Al Joslin <allen.joslin at gmail.com> wrote:
> thanks!!
> 
> I'm very glad to hear that the it's store by value and not by reference, that's perfect !!
> 
> Let me reduce my request to simplest possible contrivance -- that'll be easier then trying to explain the chain, when all that matters is the final link
> 
> I want a custom field that displays as a popup to the user -- showing String options and storing floating point values
> 
> I want the user to choose from a RatePlan CF dropdown - which displays plan names and stores as plan amounts
> 
> 	option	value
> 	Plan A	$19.99
> 	Plan B	$29.99
> 	Plan C	$39.99
> 
> I don't want the user to see the values, only the options
> 
> thanks
> al;
> 
> 
> On Jul 24, 2014, at 8:04 PM, Alex Peters <alex at peters.net> wrote:
> 
>> I'm not sure I understand your question.  Are you asking whether custom fields can hold multiple values at once?  You can set up custom fields that do this.  What exactly are you wanting to achieve?  Custom field options that depend on a previously-selected value?
>> 
>> Custom field values can safely be deleted when they should no longer be added to new tickets/transactions, because they are copied by value (not by reference) when used.
>> 
>> On 25/07/2014 6:18 am, "Al Joslin" <allen.joslin at gmail.com> wrote:
>> I am wishing that RT supported CustomFields in a way other than Name == Value
>> 
>> This makes it impossible to have a CustomField showing a bunch of Names whose Values are [for example] integer Object IDs
>> 
>> 
>> 
>> 
>> In my case I have to store billing rates for service calls, supporting multiple external service organizations with multiple rates
>> 
>> It's going to look stupid because you can only have one (1) option in the final menu
>> 
>> ServiceOrg == ServiceOrg -> RatePlan == RatePlan -> Cost $ == Cost $
>> 
>> 
>> A cascade of two would be fine -- but it's impossible, right?
>> 
>> ServiceOrg == ServiceOrg -> RatePlan == Cost $
>> 
>> 
>> 
>> Am I stuck with mashing the cost into the rate plan string and extracting that with code anytime I need the value ?
>> 
>> ServiceOrg == ServiceOrg -> RatePlan, Cost $ == RatePlan, Cost $
>> 
>> 
>> 
>> thanks
>> al;
>> 
>> 
>> Oh, another thought just occurred to me as well -- what happens in the future when Rates change ?   I don't want to have changes to the available rates change the amount's that were applied in the past !!  Is there any way to set an option within a CF to disabled ?  (exists but cannot be selected)
>> 
>> 
>> --
>> 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/20140724/3147d25b/attachment.htm>


More information about the rt-users mailing list