[rt-users] Update transaction CustomField from scrip

Kevin Falcone falcone at bestpractical.com
Fri Jul 20 15:44:29 EDT 2012


On Fri, Jul 20, 2012 at 03:06:41PM +0200, Jack Zabolotnyi wrote:
>    I'm trying to build very simple workflow:
>    1. user adds transaction to some ticket (simply comment or reply)
>    2. this transaction have couple CustomFields
>    3. After adding this transaction, i'm executing scrip (Condition: OnTransaction, Action: User
>    Defined, Stage: TransactionBatch) where I need to update this transaction's custom fields with
>    new values (based on some calculations)
> 
>    I was able to get transaction CustomField values, but i was not able to change any of them.
>    Can please anyone show me how to do it correctly?

It's easier if you show us what you're doing that doesn't work.

>    And while we're here, can anyone tell me how can i get sorting order (values of "sort" column)
>    from "select one value" custom field? (i'm thinking about using this value as a ratio for
>    items in this field that will be used later)

One problem is that you have an ObjectCustomFieldValue->Content and
you want a CustomFieldValue->SortOrder, so it's not really
straightforward.  You want to load the CustomField, call Values on it,
look for the one that matches your OCFV and then get the SortOrder.

-kevin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20120720/09a643d1/attachment.sig>


More information about the rt-users mailing list