Skip to main content

Notifications

Power Automate - Building Flows
Unanswered

Using an Expression to convert a MS Form text to a User ID

Posted on by

Hi,

 

Any advice on the below is gratefully received. 

 

I have a list of users in a drop down field in a MS Form which the user selects their Line Manager for an Approval action in Power Automate. I don't really want to use the email address of the LM in the drop down for usability reasons and therefore is there a way to convert the text from the MS form into the User Profile in Power Automate - perhaps, using a Expression in a Condition action (ie, if MS Form text = 'X', the convert to User Profile 'Y'? If, yes, could you provide some guidance on the format of the Expression as I am quite new to Expressions?

 

This is quite a long-winded method, I think, and therefore is there a better process?

 

Thank you again for any assistance/guidance. 

 

Best regards,

 

Steve

 

  • eliotcole Profile Picture
    eliotcole 4,156 on at
    Re: Using an Expression to convert a MS Form text to a User ID

    If you're putting the Run after on any action after the Approval that's on the screen, the reason it runs is that the approval will only fail if it takes a HUGE amount of time to for that to fail. Literally *any* result in the approval is still a 'successful' run of the approval action.

     

    Run after is useful for if components of your flow fail, or if you set it up to have a result that will cause a failure (like a string in an integer variable) which you can then use for forced branching.

     

    Also, I mean ... you're fine to just do multiple different actions, it's at least very controlled.

     

    However, if you want to ensure that it's just one action afterwards, then you need to ascertain what you need to set for your approval and/or anything else, to then reference within that.

     

    Again ... put your whole flow in the original question, and this will likely all start to take shape... however I'm sure you're getting there, mate.

  • SteveTaylor Profile Picture
    SteveTaylor on at
    Re: Using an Expression to convert a MS Form text to a User ID

    @eliotcole Thanks for the advice re Switches and that has streamlined the process enormously.

     

    I am now coming up against an issue where I have a common set of actions if the Approval is successful, however I cannot figure out a way of avoiding having to put them all under each Case in the Switch action.

     

    If I use the 'Configure After Run' and set to 'successful', it runs regardless of whether the Approval was approved or rejected as the flow action was completed. Is there a way I can only run the rest of the flow if the Approval was successful, without having to copy the common actions (ie, Scope - IT Approval and Comms 2) inot each case and have alot of duplication?

     

    I have been trying various solutions, but nothing quite works. 

     

    Thanks in advance for your help. 

     

    Best regards,

     

    Steve

     

     

     

    SteveTaylor_0-1660059185319.pngSteveTaylor_1-1660059225463.png

     

     

  • eliotcole Profile Picture
    eliotcole 4,156 on at
    Re: Using an Expression to convert a MS Form text to a User ID

    Just use a string type variable, that will suffice, you just 'Initialize' it before the Switch, and in each Case you will 'Set' that same variable. Since only one case will ever run on each flow run, it's all good.

     

    Then just type in their email in that 'Set variable' action in each case. 👍

     

    Either way, you can work out a lot of this by actually trying things out. 🙂

     

    Give it a go, and see what happens!

  • SteveTaylor Profile Picture
    SteveTaylor on at
    Re: Using an Expression to convert a MS Form text to a User ID

    Hi @eliotcole,

     

    Thanks for the advice - much appreciated - and I have been playing with the Switch option. In regards to the Variable, I am very new to these - which Variable type would you suggest using that will enable me to convert the drop down text to ID the user profile?

     

    Thanks again for your help,

     

    Steve

     

    SteveTaylor_0-1659539989364.png

     

  • eliotcole Profile Picture
    eliotcole 4,156 on at
    Re: Using an Expression to convert a MS Form text to a User ID

    Hi, @SteveTaylor, this one is quite simple, just make a 'Switch' action your first step after retrieving the form details (which is always the first step after the trigger in a Forms flow), and base it on the question.

     

    Then for each case, mirror the options in the dropdown question. You can then either:

    Have that fill a variable with the appropriate email/365 user, then have a generic email go to the recipient.

    Or you can build however many different actions for each option.

    Or you could combine the two.

     

    But, yeah, a Switch is your friend, here.

     

    If you had forgotten more detail, though, I suggest trying some stuff ... then editing your attempt into the question above (not into a reply) so that whomever wishes to can have more context to assist. 🙂

     

    That said, I think Switch will be just fine.

  • SteveTaylor Profile Picture
    SteveTaylor on at
    Re: Using an Expression to convert a MS Form text to a User ID

    @DamoBird365 Hi, I have just viewed your excellent blog on If Else, Else logic/expressions and wonder if this could be applied to the above issue that I have with an MS Form?

     

    I hope that it is ok to reach out to you directly and thank you in advance for any assistance you may be able to provide. 

     

    With best regards,

     

    Steve

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,487

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,014

Leaderboard