web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Create alternative UPN...
Power Automate
Answered

Create alternative UPN for users with same name

(0) ShareShare
ReportReport
Posted on by

Hi,

 

I'm building a flow to create an account for new students triggered by a form. It creates a UPN like this: "first_name.last_name@school.com".

 

Suppose John Doe is a student. He has the UPN "John.Doe@school.com". 

Next, suppose a new student has the same name. He needs a unique UPN: "John.Doe2@school.com". 

 

In order to do this, I have Power Automate Search for users (V2) with the UPN as the search term.

Then, I Initialize a viariable, being the integer 1.

Then, a Condition should check whether the UPN already exists in the SharePoint list with students. If it doesn't, it should create the first type of UPN (i.e. "John.Doe@school.com "). If it does, it should create the alternative UPN by Incrementing the integer 1 variable (i.e. "John.Doe2@school.com "). 

 

This all works fine. The problem is I can't get the condition right. This is what I have as the condition:

[value] of Search for users (V2) contains [UPN]

If yes create alternative UPN

If no create standard UPN

 

But somehow, the condition always returns true, so it always creates the alternative UPN. And when I set the condition to "does not contain" it creates the standard UPN (obviously) but when I run the flow again to have it create the alternative UPN (since the standard UPN already exists), it simply says "UPN already exists" upon creating the account. 

 

NedviceArjen_0-1597402910895.png

How do I define the proper condition?

 

 

Best,

 

Arjen

 

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    on at

    Now, suppose I would like to create a condition, such that:

     

    - if first_name.last_name@school.com already exists, create first_name.last_name2@school.com

    - if first_name.last_name2@school.com already exists, create first_name.last_name3@school.com

    - etc.

     

    Seems doable but I'm very new to Power Automate so I'm not sure where to begin.

  • Verified answer
    v-bacao-msft Profile Picture
    on at

     

    Hi @Anonymous ,

     

    Please try the following configuration:

    13.PNG

     

    Best Regards,

  • Mira Ghaly Profile Picture
    11,415 Moderator on at

    @Anonymous

    TRy to add the condition as :

    length(outputofyoursearchaction) greater than 0

    Create alternative UPN

    Else

    Create UPN

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 245 Super User 2025 Season 2

#2
Expiscornovus Profile Picture

Expiscornovus 207 Most Valuable Professional

#3
trice602 Profile Picture

trice602 185 Super User 2025 Season 2

Last 30 days Overall leaderboard