function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Galeeb SKGaleeb SK 

Email Case management

Hi ,
I am tried to send a mail to case owner, next day  the case are closed, if user has multiple cases/case records have mulptiple owners he need to get only one email.How to achieve this ,please tell me with one exapmle.
Thanks
Galeeb
Sumeet_ForceSumeet_Force
Hi Galeeb,
You can schedule a service using Schedulor class and then in the execute method in your implementation, query for records which are closed on or before yesterday. Loop through the results and identify users (owners) and respective cases (with whatever fields you need) (You can store this info in a sub class) and store the info in a Set collection

Once that is done, you can loop through set of sub class records and send the email.Use email with bulkification if there are too many emails to be triggered.
Vijay NagarathinamVijay Nagarathinam
Hi Galeeb,

You can acheive this by using workflow. To check the condition case status is Closed then send an email to corresponding case owner. I am not understand your point, you have mentioned a case record have more than users in this scenario not come to assign more than one user in case owner. I think you talking about case team right?

Thanks,
Vijay

 
Galeeb SKGaleeb SK
Hi
Vijay
We achieving this workflow its fine.We are achieving through coding.Actual scenario is if case status is closed,we send a email to case owner.if a person has multiple cases we need to send a single email to case owner.
Thanks,
Galeeb
 
Vijay NagarathinamVijay Nagarathinam
Hi Galeeb,

Use one checkbox is case object, In the apex code get all the case belongs to one user. For example User A having 32 case records ownership, Get all the 32 records and send email to corresponding case owner and update the checkbox as true. In the initial condition check the checkbox value is false then send email to corresponding case owner.

In this case one email will be send to case owner, If the owner having more than one case ownership.

Let me know if you need any help regarding this.

Thanks,
Vijay
Galeeb SKGaleeb SK
Hi Vijay,
Please tell me how it can be done using email services or apex trigger with example
Thanks
Galeeb