[rt-users] Append Data to CustomFields
Michael Coakley
mike.coakley at gmail.com
Mon Jun 4 13:25:47 EDT 2012
You are trying to get the transaction value from the ticket. You need to use the transaction object.
I'm on my phone so I can't reply with example code. If someone else doesn't supply any I'll reply with some later.
Mike
Sent from my iPhone
On Jun 4, 2012, at 10:42 AM, TheHoboKing <demon_eyes_kyoms at hotmail.com> wrote:
>
> Hi Thomas,
>
> Yes, I did attempt with TransactionBatch (and Create), the value obtained
> from the Transaction CF is always ' ' as if it's unable to capture the
> actual value.
>
> Here's the code I was using, I've tried with different variation but was
> never able to get the value that was being added in the Trans-CFs.
>
> As a test, I was simply trying to get the value from the Trans-CFs and right
> it back in a Ticket CF.
>
> --------------
> Custom Condition:
> return 1;
>
> Custom action preparation code:
> return 1;
>
> Custom action cleanup code:
> my $ticket = $self->TicketObj;
> my $cf_obj = RT::CustomField->new( $RT::SystemUser );
>
> my $cf_name = "ValueFrom_tr-cf";
> my $trcf_name = "tr-cf";
>
> my $trcf_value = "1";
>
> #Read and store the value of the Transaction CF "tr-cf"
>
> $cf_obj->LoadByName(Name=>$trcf_name);
> $trcf_value = $ticket->FirstCustomFieldValue($trcf_name);
>
> #Add the value to the Ticket CF
> $cf_obj->LoadByName(Name=>$cf_name);
> $ticket->AddCustomFieldValue(Field=>$cf_obj, Value=>$trcf_value,
> RecordTransaction=>0);
>
> return 1;
>
> ---------------------------------------------------
>
> Any ideas on what could be going wrong?
>
> Thank you
>
>
> Thomas Sibley wrote:
>>
>> On 06/04/2012 09:46 AM, TheHoboKing wrote:
>>> After some research and trial and errors I finally realise extracting
>>> values
>>> from Transaction CFs is no longer possible.
>>>
>>> The feature has been removed since RT 3.6 and doesn't seem to have been
>>> successfully implemented again. Mike seems to be the last reported
>>> successful extraction of CFs and such. (If anyone has a patch or
>>> successful
>>> scrip/solution to extract values from Trans-CFs, please by all means come
>>> forward and tell me how wrong I am)
>>
>> You can absolutely read back out values from Transaction CFs.
>> Unfortunately we can't guess what you're doing or why it's not working
>> without seeing the code. I suspect in your attempts you didn't follow
>> Mike's warning about needing to use the TransactionBatch stage for your
>> scrips.
>>
>> Thomas
>>
>>
> --
> View this message in context: http://old.nabble.com/Append-Data-to-CustomFields-tp33920988p33958371.html
> Sent from the Request Tracker - User mailing list archive at Nabble.com.
>
More information about the rt-users
mailing list