Id developing a ticketing platform. I have set an add view to send a mail to my support email address when a user creates a new ticket,which is always the same.
Then, if the user adds a message, the view send a mail to my support email address, which is always the same too.
But, if me, as an admin, I add a new message, I need to search what email does the user has in their account to send the email to the user like “hey you goy a new response for the ticket XXX from an operator or admin”.
Is there any posibilities i can make the $rec_email has a sql value like: SELECT email FROM users WHERE user_id=the_id_of_the_person_who_created_the_ticket ?
Use the Action After Add configuration in Page Events, to query the email from your database and send the mail to the user. There are snippets on the right panel for queries and also to send emails, you just have to double click to get the snippet.
It is a ticket system, so there are users who report tickets, a ticket table where information is stored about the tickets that users register along with the ID of the user who has registered that ticket, and a table of messages from tickets, where discussions are added to user tickets and operator responses in which is the ID of the ticket to which that response belongs, so that subqueries can be made like:
From the ticket_messages table I have to be able to get the email of the user who has reported the ticket to which I am adding the message.
You either write a query using JOIN to links the tables or you query each table using the result from each query to make the quesry for the next table. use the ticket_id to get ticket details, then use the user_id form ticket table to get the user details.