Is there a way to change the value of a Transaction custom field?

Any issue about Cyclos 4 scripting and Webservices

Moderators: alexandre, hugo, rmvanarkel

Post Reply
EdwinMor
Posts: 22
Joined: Tue Sep 15, 2020 10:31 am
Location: El Salvador
Contact:

Is there a way to change the value of a Transaction custom field?

Post by EdwinMor »

I was wondering if there is a way to change the value of a transaction custom field on a completed transfer through the scripting interface.
luis
Posts: 265
Joined: Fri Feb 17, 2006 11:01 am

Re: Is there a way to change the value of a Transaction custom field?

Post by luis »

You can manually change custom field values of a transaction like this:

Code: Select all

def fields = scriptHelper.wrap(transaction)
fields.customFieldInternalName = newValue
It will be persisted on commit.
Note that in case OpenSearch is used, it won't be automatically reindexed (would need to be done with transactionSearchHandler.index(transaction).
Luis Fernando Planella Gonzalez
Cyclos development team
Post Reply