Closed SinghNanak closed 1 year ago
E.g.: It sends an email to all project's members with the role 3 if the status is changed to 6.
Before save
@status_changed = status_id_changed? && !new_record?
After save
if @status_changed && (self.status_id == 6) # Rejected
recipients = [];
self.project.members.each do |member|
if member.member_roles.collect(&:role_id).include?(3) # Manager
recipients << member.user
end
end
subject = 'Issue status changed'
body = "The status of ##{self.id} has been changed to Rejected"
recipients.each do |recipient|
CustomWorkflowMailer.deliver_custom_email(recipient,
subject, body)
end
end
Thank you, I appreciate your help
@picman can you help plz. i want to send email to role(project manager) when a issues status is changed to hold. can you create a workflow for that.