Project

General

Profile

modify the value of a custom field within the script?

Added by Jav Ovo 29 days ago

Hello,

I am working on a custom workflow script in Redmine and need assistance with reading and writing the value of a custom field for an issue. I want to manipulate the custom field's value during certain transitions in my workflow.

Specifically, I am looking to achieve the following:

Reading a custom field value - How can I access the value of a custom field for an issue within a custom workflow script?
Writing to a custom field - How can I update or modify the value of a custom field within the script?
Any guidance on how to interact with custom fields (both reading and writing) would be greatly appreciated. I’m particularly interested in understanding the correct syntax, methods, or Redmine API calls needed for this task.

Thanks in advance!


Replies (2)

RE: modify the value of a custom field within the script? - Added by Holger Just 29 days ago

There are examples at Rest_api and Rest_Issues.

If you have a more specific question or failing code, please add more details and show your code, example data, and all error messages you may receive in full.

RE: modify the value of a custom field within the script? - Added by Fone Ek about 5 hours ago

Jav Ovo wrote:

Hello,

I am working on a custom workflow script in Redmine and need assistance with reading and writing the value of a custom field for an issue. I want to manipulate the custom field's value during certain transitions in my workflow.

Specifically, I am looking to achieve the following:

Reading a custom field value - How can I access the value of a custom field for an issue within a custom workflow script?
Writing to a custom field - How can I update or modify the value of a custom field within the script?
Any guidance on how to interact with custom fields (both reading and writing) would be greatly appreciated. I’m particularly interested in understanding https://www.redhumana.com.co the correct syntax, methods, or Redmine API calls needed for this task.

Thanks in advance!

Hello,

you can access it like this: custom_field_value = issue.custom_field_values.find { |cf| cf.custom_field.id == CUSTOM_FIELD_ID }
value = custom_field_value ? custom_field_value.value : nil
To write to a custom field, update its value and save the issue: issue.custom_field_values = { CUSTOM_FIELD_ID => 'New Value' }
issue.save!

Best Regard,
Melissa

    (1-2/2)