[rt-users] Set Content via Scrip

Ruslan Zakirov ruz at bestpractical.com
Fri Jun 15 12:19:59 EDT 2012


Hi,

Transaction CFs are called "transaction CFs" because they need a
transaction to be recorded. Probably the right thing to do is to
return people back to the form if they picked CF values and didn't
enter any message.

Looks like you use TxnFCs to implement "change ticket CFs on update
(reply/comment)". If so then wiki has code to make it possible. May be
these days an extension exists to do it.

On Fri, Jun 15, 2012 at 1:36 AM, TheHoboKing
<demon_eyes_kyoms at hotmail.com> wrote:
>
> Hello All,
>
> Im running RT.4.0.5.
>
> I've been trying to automatically set the Content(message body) of a comment
> on a ticket.
>
> I can get the value from the message input box via
> "$self->TransactionObj->Content" but I'm unable to set it via a scrip.
>
> I've attempted via "$self->TransactionObj->SetContent($MyValue)" and various
> other means (ContentObj | TicketObj | Transaction->Message | ...) but none
> works...
>
> Here's a brief explanation on why I'm attempting to do this:
>
> I've a couple of Transaction Custom fields, for which I store the input
> value in a Ticket CustomField (I do this via a TransactionBatch Scrip), this
> works fine on Ticket Creation and as long as the message box contains
> whatever value during Comment | Reply | Resolve | Re-Open |... . But if the
> message box is left empty, the valued entered in the Transaction CF is not
> added to the Ticket CF (perhaps the Scrip is not even run because there's
> Transaction to be recorded?).
>
> How could I either force a TransactionBatch scrip to run even if the message
> box is left empty or automatically set a value to Content (the message box).
>
> After taking a look at the RT Logger, it looks like the Scrip is not being
> executed if the message box is empty (no Transaction to be recorded perhaps?
> even though I'm inputting new values in the Transaction CF(s)).
>
> Nonetheless here's my Scrip that tries and set a value to Content
>
> Custom condition:
> return 1;
> Custom action preparation code:
> return 1;
>
> Custom action cleanup code:
> my $Trans = $self->TransactionObj;
>
> my $content = $Trans->Content;
> my $MyValue = 'ScriptedValue';
>
> $Trans->SetContent($MyValue);
>
> $RT::Logger->debug("$self->TransactionObj->Content: $content");
>
>
> Thank you all!
> --
> View this message in context: http://old.nabble.com/Set-Content-via-Scrip-tp34014709p34014709.html
> Sent from the Request Tracker - User mailing list archive at Nabble.com.
>



-- 
Best regards, Ruslan.



More information about the rt-users mailing list