
JustinC.61274 (Customer) asked a question.
As part of the new user creation workflow we check to see if a username is used to add logic to append a number, etc.
however, not all of the users we have in AD were added to Okta because we switched HRIS apps.
That currently leaves roughly 2000 true or 6000 total users that exist in AD but not in Okta, which means the account will usually get stuck in staged or activating since the username address field fails to be unique.
Aside from adding all the users to Okta which may mean reactivating and then deactivating users, which will scare our sec team, the other solution proposed is to have a static list of the users (aka the true differences) that Okta could parse through during the unique username generation workflow.
Ideally its a "variable" or something that can be referenced within Workflows and not have to query an excel file or something.
My google fu has let me down and I am unable to find a way to add a static list of users.
Thanks in advance, all!

Hello @JustinC.61274 (Customer) Thank you for reacting out to our Community!
As a proposed solution for your request, we have this proposed template "Generate unique Okta usernames" from our list of templates here:
https://help.okta.com/wf/en-us/Content/Topics/Workflows/templates/templates-list.htm
Please see our documentation for this below:
https://github.com/okta/workflows-templates/blob/master/workflows/generate_unique_username/readme.md
Hope this helps and if this answered your question, please mark this as Best Answer!
Something to keep in mind: In a scenario where you are importing a bunch of users all at the same time they are all going to be evaluated at essentially the same time. This process is "error prone" and here is the logic on why
So for example lets say your naming convention is <first letter of firstname>.<lastname>@domain existing environment has:
John doe
Jon doe
Jane doe
Jenny doe
There are going to be 4 attempts to make j.doe@domain. Only one is going to win. Since none already existed they wouldn't hit any sort of trigger to "rename them". On the next pass lets say "John doe" won so he is j.doe@domain. So the remaining three get imported again. All three will do a check and see j.doe exists. They will all increment to j.doe1 and there will be one winner.
However, if you have an existing setup environment and there is already a j.doe, j.doe1,j.doe2 and you are bringing in Jenny Doe an evaluation can be made to find j.doe2 as the "highest increment" and increase the number by one without any problems.
My suggestion:
While it is possible to build something out in Workflows to do all of the evaluation/renaming etc it would probably be easier for you to figure out the logic to assign unique names using something local like powershell/python and outputting a CSV. That CSV could then either be (complete) and imported directly into Okta OR partial, and imported into a Workflows Table and used as the source-of-truth for the rest of the actions you want to take in the flow such as creating users, assigning apps etc.
Even if you were to do it in Workflows entirely, I would still buildout a CSV that contains first,last,email (email would be blank) at a minimum So:
john,doe,
jane,doe,
jenny,doe,
And import this into a Workflows table. You could then setup a recursive processing of the list incrementing the offset by 1 and processing one row at a time. Basically, read an entry, generate the expected email format, see if it exists (return all j.doe), determine the highest increment, increment, update the table. Once completed you would have a data set containing the first,last,incrementedEmail that could be leverage in another flow to make users.
Unfortunately, there just really isn't an easy, non-complex solution for this use case.
this might be something the team will have to investigate in the future, but as a temporary stop gap before we make drastic changes to the workflow with limited personnel, is my request possible?
example:
Proposed solution:
a static list of X usernames/emails, maybe JSON format, or i guess CSV if need be, where the process can query for matches
the problem here is that Im not aware of how to create said static list to query, and to be clear, not a static list to be generated at time of workflow (though if there is a guide on that ill take it too), but more so a static list in Workflows thats accessible by the workflow that we can alter at will, if that makes sense.
That way, as it goes through the account creation process, one of the steps is to parse the CSV or JSON data and generate a unique username based on that.
I have also tried "pluck", which seems reasonable enough.
I tested the card itself with a list of dicts and my results are null.
I even tested the exactly example shown here: https://help.okta.com/wf/en-us/Content/Topics/Workflows/function-reference/List/list_pluck.htm, and my results for values is "null"
So real fast: The structure of your Pluck example isn't going to work. If you put those values into a "compose" card > Json Parse > Pluck (name) it would work. The reason it isn't working is because the value you are inserting. [] is already assumed. The + click to add item is going to be each object in the list. so {"name":"Sarah","gender":"female"} would be 1 +click the other person would be another +click
So ultimately, what you are attempting to achieve is definitely doable if the "input" to be updated is coming in basically one at a time. The problem is when bulk is coming in AND there are more than one user that would evaluate to the same value. If they are both processing at the same time they will both see the same current "Truth" and attempt to adjust to the same value.
So lets say you feed in a user as an input, you can then perform logic to build out the desired syntax like jane doe would be j.doe. You then "List users with search" for j.doe and determine if any exist. If they do exist you can order that list, take the highest incremented user, then increment that user by 1. That "new" value would then be utilized to create the user.
ok, i tried some changes and am able to parse a json file in text format all the way to selecting just the specific key and doing the return, however, when i return the data in the parent caller, it gets no data.
I tried object as list, text as list, just text, etc, to no avail.
the output of the pluck is set to text as list, the return input is also text as list (validated accuracy by testing the individual flow itself).
When i got back to my parent flow, i even tried using the same variable as the child flow along with making a new one (both are text as list) and i get a null result.
If i can get the output to be correct from the child flow, then i think my last step is to simply refer back to the variable (values, listOFusernamnes, etc) and use that as part of the username validation.
nvm i think i got it.
left the return variable as "input" instead of "values" even though thats the name of the var i was passing to return
When you call a flow. The "Return" card variable name(s) must match what you defined as variables in call flow card.
As an example I defined "returnedNumber" on the call flow
So now if I run the flow:
The idea here is the variable you define at the "Parent" level will have a value assigned by the Helper flow's Return card. If the variable names don't match it will assign the value to a variable that doesn't exist at the Parent level.
I've attached incrementing logic flow that I built awhile back. It takes a string input and will increment the value by 1 and provide the output and can handle odd scenarios like j.doe0002 and return j.doe0003. You will just need to build logic to figure out how to identify the "current highest increment" of a name.
incrementusernamebyonefinal