Upon modification of one of our custom fields (text area),
we want to parse the data, perform a translation on the
original data, and store the results in the custom field.
Simplified/contrived example:
INPUT:
Basics:
OurField: 4 5 8 9 32 90
[SAVE]*click*
RESULT:
Basics:
OurField: X Y A B Z O
We’re obviously using a Scrip to do this field processing.
It’s not working out too hot, so I must be doing something
wrong.
Name: ParseAndWrite_Ourfield
User Defined
User Defined
Blank template
TransactionCreate
Custom condition:
if field changed
return 1
Preparation:
return 1
Clean-up:
parse ourfield
initialize final_string to ""
for each item found:
perform lookup
append lookup result to final_string
set OurField value to final_string
return 1
With loads of RT::Logger debugging in place, everything appears
to be working fine except for the for the fact that the Scrip
is being called twice, and it’s performing the change … then
UNDOING IT:
Sep 10 16:24:39 rtdev2 RT: START SCRIP processing OurField
Sep 10 16:24:39 rtdev2 RT: OurField changed: OLD ‘’ NEW '26 34’
Sep 10 16:24:39 rtdev2 RT: OurField: In main chunk
Sep 10 16:24:39 rtdev2 RT: OurField: 2 values found
Sep 10 16:24:39 rtdev2 RT: OurField: Processing: '26’
Sep 10 16:24:39 rtdev2 RT: OurField: Processing: '34’
Sep 10 16:24:39 rtdev2 RT: OurField: Final string: 'X Y’
Sep 10 16:24:39 rtdev2 RT: OurField reached final return 1
Sep 10 16:24:39 rtdev2 RT: START SCRIP processing OurField
Sep 10 16:24:39 rtdev2 RT: OurField changed: OLD ‘X Y’ NEW ''
Sep 10 16:24:39 rtdev2 RT: OurField: In main chunk
Sep 10 16:24:39 rtdev2 RT: OurField: 0 values found
Sep 10 16:24:39 rtdev2 RT: OurField: Final string empty, so clearing out
OurField entirely
Sep 10 16:24:39 rtdev2 RT: OurField reached final return 1