Closed mandor3 closed 2 years ago
Hi,
What is your exact intention? To change the status or change the priority? Because you wrote about status, but in your code you try to change the priority.
Note: You should use your code in BEFORE SAVE section
Hi again, Yes, I'm talking about priority. Tell me, please, what could be the problem?
Hi,
Try this code in BEFORE SAVE section:
@issue.priority_id=(5) if new_record? && tracker_id == '16'
I hope it helps!
Wow, it works. Thank you. Can I ask a couple more questions without creating a new topic also related to this new tracker?
I’m glad to hear that!
Yes, you can ask, I try to help, if I can.
Good morning! I use the custom Datetime field from this plugin in the "Incidents" tracker https://www.redmine.org/plugins/redmine_datetime_custom_field Can custom workflow work with this? If yes, then in this case, tell me how to implement it so that it refers to the "Completion date" field and, until it is filled, does not give the opportunity to close or cancel the task?
Hi,
The datetime customfield is working same as other customfields. To avoid closing with missing datetime, use this code in BEFORE SAVE section:
if (closing? || closed?) && !custom_field_value(1).present?
errors.add(:base,"The Completion date field shall be filled before closing!")
return true
end
Change the custom field id in code! The number "1" shall be changed:
!custom_field_value(1).present?
I hope it helps!
Thank you, everything works fine, sorry for the long absence - a lot of work
Hello, I am a ruby noob, I used this plugin in search of a solution for the flexibility of a new tracker. I want all tasks of the new tracker to be automatically assigned the status immediate when created, but the default status remains normal. I wrote this code and I don't understand why it doesn't work: if @issue.new_record? if(@issue.tracker_id == '16') @issue.priority_id = '5' end end