- 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 06:31 AM
sorry to bother you again but I need more details.
I have created a flow variable called "emailBody" of type String (screendump 1 in word attachment)
After I have created the request (and made a few updates to it) I have created a "Set Flow Variables" flow logic (screendump 2 in word attachment) - but is does not seem to work.
Futhermore I would like to use that flow variable in a "Send Mail" action in the body. I have tried what you suggested with the ${....} but it does not work (Screenshot 3 in word attachment)
Can you help with more specific steps.
Kind Regards
Søren