Update transaction CustomField from scrip

Hi everyone!

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?

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)

Thank you in advance!

Jack Zabolotnyi
Arces Network, LLC

e: jzabolotnyi@arces.net
w: http://www.arces.net

PGP key: 2048R/7F2AB658 2012-07-02
PGP fingerprint: 4C7E 00A8 5210 F3D9 0509 C70E 87C8 666E 7F2A B658

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