- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 11:48 PM
Hi
I have created a flow (with subflow) that creates a request item (sc_req_item) for ordering IT Equipment for new hires (triggered from the HR Profiles table).
Flow loops through all new hires, finds out if a request for hardware has already been made and if not, create the request. All of this works perfectly.
What I would like at the end is to send an email where the body has some information about the requests that has been created, eg
RITM00123456 - <<user name1>> - <<hire date1>> - <<manager name1>>
RITM00123457 - <<user name2>> - <<hire date2>> - <<manager name2>>
RITM00123458 - <<user name3>> - <<hire date3>> - <<manager name3>>
You get the picture 🙂
What I would like to capture is above information for each request created somehow and use that in the email body.
I have searched and searched but have not been able to find something useful
Kind Regards
Søren
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2024 01:20 AM
Here are the steps you can follow to achieve this:
1. Create a variable to store the information for each request. This could be a string variable that you append to for each new hire processed. For example, you could name this variable emailBody.
2. In your flow, after creating the request item (sc_req_item), append the necessary information to the emailBody variable. You can use the + operator to append strings in ServiceNow. For example:
emailBody = emailBody + 'RITM' + ritmNumber + ' - ' + userName + ' - ' + hireDate + ' - ' + managerName + '\n';
Replace ritmNumber, userName, hireDate, and managerName with the appropriate variables or field values from your flow.
3. After your loop finishes processing all new hires, you can use the emailBody variable in your email notification. In the email notification record, you can insert the variable into the message body using the ${emailBody} syntax.
4. To ensure that the email is sent only once after all the requests have been created, place the email notification action outside the loop, after all the processing is done.
5. Test your flow to ensure that the email is sent correctly and contains the expected information for each request.
Remember to reset the emailBody variable to an empty string at the start of your flow to ensure that it doesn't contain information from previous runs.
nowKB.com
For asking ServiceNow-related questions try this :
For a better and more optimistic result, please visit this website. It uses a Chat Generative Pre-Trained Transformer ( GPT ) technology for solving ServiceNow-related issues.
Link - https://nowgpt.ai/
For the ServiceNow Certified System Administrator exams try this :
https://www.udemy.com/course/servicenow-csa-admin-certification-exam-2023/?couponCode=NOW-DEVELOPER

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2024 12:44 AM
@s_renjarnbo Since you are already using a flow which loops through all the new hires and creates a request for IT Equipment ordering, why can't you use the same flow to trigger the notification body, all these information should be already available in the flow designer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2024 01:01 AM
Hi Sandeep
Thanks for replying 🙂
I dont want to send an email per loop. I want to send ONE email at the end of the loop with the information of all created requests.
I simply dont know how to achieve this. I am fairly new to Flow Designer.
Kind Regard
Søren

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2024 01:05 AM
@s_renjarnbo I recommend you to go through flow variable documentation https://docs.servicenow.com/bundle/vancouver-build-workflows/page/administer/flow-designer/concept/f... Using the flow variable, you can capture all the values in an object/array and once the loop finishes you can use a send email action and extract all the values from the flow variable and add the same in the email body.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2024 01:09 AM
@Sandeep Rajput Thanks again.
I know how to use variables in Flow Designer and are actually using them in the flow in question.
What I dont know - and cannot read from the referenced documentation - is how to create a flow variable as an object ? and also how to use it in the email body.
Regards
Søren