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
MyGodItsColdMyGodItsCold 

want to send Email Alert to current user

I want to send an Email Alert to the current user. I tried putting:

{!$User.email}

into the Additional Emails text box, but got the message:

Error: Email addresses must be valid emails

Is there a different way to do this, or must I go to a trigger?

werewolfwerewolf
Presumably the current user has just made a change that has triggered the workflow.  As such you could send the email alert to Related User:Last Modified By (which you'd find up in the standard Recipients list).
Ajay K DubediAjay K Dubedi
Hi MyGodItsCold,

Try the below code to send an email to logged in user:
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
                string [] toaddress=New string[]{UserInfo.getUserEmail()};
                email.setSubject('Regarding:'Send alert to user');
                email.setPlainTextBody('want to send Email Alert to current user');
                email.setToAddresses(toaddress);
            Messaging.sendEmail(New Messaging.SingleEmailMessage[]{email});

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
 
N.M. SharmaN.M. Sharma
A Reply for upcoming users:

Faced the same issue: For solution, we used Related User: Last Modified By
We use this because the workflow is initiated because the logged-in user made some changes over the record and the person is the one fetched in Last Modified by.
Can use Email Alerts when we want to send the email to the login user.