Closed gaurav-cointab closed 1 year ago
I am trying to use this in before save.
if (@issue.tracker_id == 22 or @issue.tracker_id == 23) and (@issue.status_id == 3 or @issue.status_id == 5 or @issue.status_id == 6) and !@issue.notes.nil? raise WorkflowError, 'Since you are closing this task, the notes are mandatory' end
It is possible that I am trying to access the notes field in the wrong way, or the condition for it is wrong. I want to raise the error only if the notes field is blank, not set. How to achieve this?
I have also tried to change @issue.notes, @journal.notes and @current_journal.notes. Still not working.
Found the solution in this:
Hi Team,
I am trying to build a workflow where I am trying to make "notes", as mandatory for certain type of project, for a certain tracker, for a certain status. So this will go into the before save issue flow.
In that I need to check if the user is marking a certain tracker in a certain project (with a custom field having a certain value) to have notes as mandatory. So I can achieve this by adding the below mentioned sudo logic in the before save.
First check for the tracker_id to be equal to certain id. Then check for the custom field of the project to be equal to a certain value. Then check for the status_id to be equal to a certain value. The check if the notes fields is blank, then raise error, otherwise allow it to run smoothly.
These steps are correct? If yes, then it would be helpful to help me write this. A certain code with placeholders would be very much appreciated.