Closed lublasco closed 3 years ago
Hi, I was able to solve this, more or less.
# = before save = #
if @issue.status_id_changed? && @issue.status_id == 1 && (tracker_id == 2 or tracker_id == 4)
@issue.status_id = 2
#issue should also be assigned to author automatically
@issue.assigned_to_id = author
@workflow_autonote = subject.present? ? (status_id_changed?) : false
end
# = after save = #
if @workflow_autonote
auto_note = 'Note: this is the note about the automatism'
@issue.journals << Journal.new(:journalized => @issue, :notes =>auto_note, :user_id => 999)
end
The problem with this solution is that in history the user's manual transition from status x to status 1 is not being registered. So I decided to include an automatic note to indicate the two steps.
Hope this helps.
Hi,
after a user sets an issue (tracker 4) in status 1 the workflow should change the issue to status 2 automatically. Both actions should be saved in the issue history.
This is my snippet:
This code correctly performs the automation but does not reflect the user manual action (changing issue to status 1). It only reflects a change performed by the user directly to status 2.
How should the snippet look like to reflect both changes (user's manual change to status 1 and worklow's automatic change to status 2)?
I understand the automation should be placed in the "after save" part but just inserting the code in this part does not perform the workflow.
Finally, I would also need that, if possible, the automated step (from status 1 to status 2) is performed by user id=999 (not being assigned user nor author).
Thanks in advance for your help and congratulations for the most useful plugin :)