How to set "From" in Notifications for a Catalog Form and how does it work internally? Please guide

AbdurRahmanSnow
Giga Guru

Good morning.
I have built a Catalog Form where there is a question asked, "Which mailbox should the email be sent from?", which has 3 emails in it.

AbdurRahmanSnow_0-1753035315317.png
So, when the email is selected, it should become the "From" and send it to the "Requested for" and "Supplied email address".

AbdurRahmanSnow_1-1753035694907.png
How can we do this in Flow designer? I am totally confused. Please help. 
Also, we need to use "Notification" action to set "From", but the problem is, we don't have "To" in flow.
If we use "Email" action, then we can't set "From". Because we need to get data from Catalog Form and set it in the Notification/Email.

My friend suggested to with as below. But I did not understand. Please help. Also, I don't know how does "From" work internally, when we don't have those email accounts.
Flow action -> Object to String (from, to, subject, body) -> Notification: Use mail script to set From, to, ....

Please help

4 ACCEPTED SOLUTIONS

Bhimashankar H
Mega Sage

Hi @AbdurRahmanSnow ,

 

As it is asking to select you the 'From' mailbox, it means whenever it send an email then in their mail box it will show that, sent from that email id and display name like PDI@servicenow.com, or supportPDI@servicenow.com, etc. so these are setup in your SMTP server configuration and you can add to that list as well. The mail will sent by your domain only but the email address and display name it will show different.

 

Once you set the 'from', you will get the catalog from data using action called 'Get catalog variable'  and you can use these variables to get the submitted data.

 

Thanks,
Bhimashankar H

 

------------------------------------------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful'/'Correct'.  Thanks!

 

View solution in original post

Ankur Bawiskar
Tera Patron
Tera Patron

@AbdurRahmanSnow 

Please don't use "Send Email" flow action, instead you should use "Send Notification" and trigger the notification from flow.

Then use email script to set the from email address by accessing the variable value

(function runMailScript(current, email, template, email_action, event) {
    email.setFrom(current.variables.variableName);
})(current, email, template, email_action, event);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

@AbdurRahmanSnow 

To means recipient, for that you can't use email script

You can't set the Recipients using "Send Notification" flow so you need to Trigger an Event and pass the parameters event parm1 and parm2

Then in notification ensure you use the checkbox "Event parm1 contains recipient"

Use "Create Record" on sysevent table, pass the parm1 or parm2 and then link the notification with this event

AnkurBawiskar_0-1753103785137.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

AbdurRahmanSnow
Giga Guru

Thank you so much @Ankur Bawiskar , @Bhimashankar H and @Dr Atul G- LNG 
I have successfully done the changes and is now working awesome. You all saved my day.!

Implementation which I followed (will be helpful to future developers):
Firstly, created an event and in the Flow Designer, created the event record and called it.

AbdurRahmanSnow_1-1753128762517.png

Then created a mail script to set "From" and "Reply to".

AbdurRahmanSnow_2-1753128825202.png

Then called the event in Notification.

AbdurRahmanSnow_3-1753128932810.pngAbdurRahmanSnow_4-1753128959677.pngAbdurRahmanSnow_5-1753128981409.pngAbdurRahmanSnow_6-1753129017974.png

 

Finally, the Output in email logs:

AbdurRahmanSnow_7-1753129152632.png

 

AbdurRahmanSnow_9-1753129261810.png

Thank you.

View solution in original post

12 REPLIES 12

Hi @Ankur Bawiskar / @Dr Atul G- LNG 
Just wanted to ask, I did not even create a new Email account, and still I was able to set the "From" in Notification and it worked. Email got triggered. How is it possible? (Screenshot above)
Is the primary email account masking the newer one internally? How is it working?

Hi @AbdurRahmanSnow 

If there is no account set up, the email will not be sent, but it will still be triggered and appear in the email logs.
This is the expected behavior, as per my understanding.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

AbdurRahmanSnow
Giga Guru

Thank you so much @Ankur Bawiskar , @Bhimashankar H and @Dr Atul G- LNG 
I have successfully done the changes and is now working awesome. You all saved my day.!

Implementation which I followed (will be helpful to future developers):
Firstly, created an event and in the Flow Designer, created the event record and called it.

AbdurRahmanSnow_1-1753128762517.png

Then created a mail script to set "From" and "Reply to".

AbdurRahmanSnow_2-1753128825202.png

Then called the event in Notification.

AbdurRahmanSnow_3-1753128932810.pngAbdurRahmanSnow_4-1753128959677.pngAbdurRahmanSnow_5-1753128981409.pngAbdurRahmanSnow_6-1753129017974.png

 

Finally, the Output in email logs:

AbdurRahmanSnow_7-1753129152632.png

 

AbdurRahmanSnow_9-1753129261810.png

Thank you.