- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 07:56 AM
Hi Community, I've got a weird ask but I'm trying to create a Flow which will automatically run each day and check certain user's emails and update them if they don't match what they should be representing.
The problem I'm running into is that when I attempt scripting the Email field on the Flow, I get an internal system error and the logs are not being helpful for what the issue is.
Currently I'm only drafting my Flow, so I'm testing with a single user. It will:
- Look up a specific user by their user ID.
- Attempt to update their email with the following script:
//Grabs the current email on the User Record.
var currentEmail = fd_data._1__look_up_record.current.email;
//Replaces the end of the string with the updated information.
var updatedEmail = currentEmail.replace("@email.com","2@email.com");
//Return the updated value.
return updatedEmail;
- Return that value and push the update.
Am I being silly trying to use replace in this way, or am I attempting to grab the Flow variable incorrectly? Any help is appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 10:50 AM
Managed to figure out my problem with the help of Now Support.
I was following the example script that shows up when you start creating a script in Flow Designer, but it turns out that different actions can have different ways to access those Flow variables.
For example, a record lookup would utilize:
var currentEmail = fd_data._1__look_up_record.record.email;
Meanwhile, a "For Each" loop would use:
var currentEmail = fd_data._1__for_each.item.email;
Seems like the best way is to just use the auto-suggest when typing your script, as it will know what is correct for that specific action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 10:50 AM
Managed to figure out my problem with the help of Now Support.
I was following the example script that shows up when you start creating a script in Flow Designer, but it turns out that different actions can have different ways to access those Flow variables.
For example, a record lookup would utilize:
var currentEmail = fd_data._1__look_up_record.record.email;
Meanwhile, a "For Each" loop would use:
var currentEmail = fd_data._1__for_each.item.email;
Seems like the best way is to just use the auto-suggest when typing your script, as it will know what is correct for that specific action.