This article provides the code snippet to copy field value (the value before the transition) to another field using Set issue fields post-function.
Navigate to the intended workflow to make the necessary changes in the edit mode.
Select the required transition.
Select the Post functions tab and click Add post function
.
Add the Set issue fields post-function.
Select the issues for which the field should be set under “Target Issue(s)”.
Select the desired field and add the below Nunjucks template:
{{ context.changelog.fields["customfield_10062"].from_string }} |
Replace 10062
with the id of the source field.
Select the checkbox “Run this post-function only if a condition is verified” under “Conditional Execution” and add the below Condition:
{{ context.changelog.fields["customfield_10062"] }} |
Replace 10062
with the id of the source field. The above condition checks that the field value is changed during the transition. Check the documentation here.
Note: The post-function must be placed after the “Update change history for an issue and store the issue in the database” built-in post-function. |