Power Apps Exchange

Please login or click SIGN UP FOR FREE to create your PowerAppsUG account to join this user group.
Expand all | Collapse all

Auto Populating Employee Profile Information

  • 1.  Auto Populating Employee Profile Information

    Bronze Contributor
    Posted May 13, 2020 05:52 PM
    Hello Everyone,

    I've been requested to create a PowerApp that automatically pulls in the user, their manager, and their location into separate fields.  I need help writing the formula that will pull that information from AAD.  I've created an Office 365 User connection and the PowerApp will be writing the data to a SharePoint list.  Any assistance would be greatly appreciated.

    Thanks,
    Chad

    ------------------------------
    Chad DeCoteau
    Collaboration Specialist
    Fargo ND
    7014763191
    ------------------------------


  • 2.  RE: Auto Populating Employee Profile Information

    Posted May 14, 2020 04:00 AM
    HI Chad

    Hope you are doing well.

    If you mean to use the Data source Office365Users in Power Apps to retrieve this info, then give these lines a try:

    In the Current user textbox/label
    Office365Users.MyProfileV2().displayName

    In the Location textbox/label
    Office365Users.MyProfileV2().officeLocation
    **Note you can also use city if it fits better

    In the Manager textbox/label
    Office365Users.ManagerV2(Office365Users.MyProfileV2().mail).displayName

    You could take those outputs and have them pushed into SharePoint using the Form in Power Apps.

    Hope that helps?

    Cheers
    Damien

    ------------------------------
    Damien Rosario
    Knowledge and Training Coordinator
    ------------------------------



  • 3.  RE: Auto Populating Employee Profile Information

    Top Contributor
    Posted May 14, 2020 09:46 AM
    Of course, this assumes that that data exists in the AAD. I've been in discussions with our organization to try to get all that data and put it into the AAD. Then someone needs to maintain all that data. In our organization people move around fairly often, so it takes some effort!

    ------------------------------
    Brian Scott
    Chief Creative Officer
    Concord NC
    ------------------------------



  • 4.  RE: Auto Populating Employee Profile Information

    Bronze Contributor
    Posted May 14, 2020 05:53 PM
    Hi Damien,

    Thanks so much.  I was way overthinking those formulas.  Those worked perfectly (almost)!!

    When we run the app, however, we get an:

    "Office365Users.ManagerV2 failed: The method 'ManagerV2' has an invalid value for parameter 'id'" error.

    Any suggestions on how to fix that?

    Thanks again,
    Chad

    ------------------------------
    Chad DeCoteau
    Collaboration Specialist
    Fargo ND
    7014763191
    ------------------------------



  • 5.  RE: Auto Populating Employee Profile Information

    Posted May 14, 2020 09:02 PM
    Hi Chad

    Glad that helped out.

    Weird about the Manager one as this should work and I have just tested it and it's definitely the right code.

    Maybe try to diagnose the issue by splitting up the components and seeing where the error might be?

    Example:

    1. Put Office365Users.MyProfileV2().mail into a label or textbox to see if it correctly shows your email address.

    2. Manually type your email into Office365Users.ManagerV2(drosario@kordamentha.com).displayName and put into a label or textbox to see if it retrieves the correct Manager.

    3. Only other thing I can think of is to see if you have the manager has been entered correctly in Azure. If there's no Manager listed, maybe that's what's causing the issue?

    Hope that gives you something to work with.

    Please let us know how you go?

    Cheers
    Damien

    ------------------------------
    Damien Rosario
    Knowledge and Training Coordinator
    ------------------------------



  • 6.  RE: Auto Populating Employee Profile Information

    Bronze Contributor
    Posted May 28, 2020 09:46 AM
    Hi Damien,

    I was able to get it to work but had to wrap it in If(isBlank statement.  Thanks again for your help and recommendations!

    The last issue I ran into, is now when I test the app in the PowerApps web part on a modern page, the Exit button doesn't do anything like it does in the stand-alone app (which works exactly as expected).  If there a way I could code the Exit button to hide in the web part but not anywhere else?  I have a "Add New Event" button already for users in the web part that would replace the functionality of the "Exit" button.

    Thanks again,
    Chad

    ------------------------------
    Chad DeCoteau
    Collaboration Specialist
    Fargo ND
    7014763191
    ------------------------------



  • 7.  RE: Auto Populating Employee Profile Information

    Posted May 28, 2020 07:54 PM
    Hi Chad

    Glad the ideas have worked out. IsBlank would work if the manager field is blank in a record so you must have some staff who do not have a manager assigned to them.

    For your last issue, I'm not entirely sure I understand the scenario so I've got a few questions to flesh it out.

    1. Where does the Exit button go to?
    2. What do you mean by hide the Exit button in the web part but not anywhere else? What does anywhere else mean?
    3. For the Add new event button, you've used it to replace the function of the Exit button. Could this button replace Exit in general so you don't have two conflicting buttons?
    4. Are users purely using this app in the web part and not as a standalone app or will they be doing it in both? If it's web part only, you may want to program for that instead of the standalone. Go with the scenario most used.

    Cheers
    Damien

    ------------------------------
    Damien Rosario
    Knowledge and Training Coordinator
    ------------------------------



  • 8.  RE: Auto Populating Employee Profile Information

    Bronze Contributor
    Posted Jun 02, 2020 04:04 PM
    Hi Damien,

    Currently, I'm testing the app in three places.  The first is in the PowerApps mobile app, the second is as a stand-alone app within PowerApps and the third is on a modern SharePoint online page within the PowerApps web part.  The "Exit" button in the mobile app takes the user back to the list of PowerApps, which is just fine.  The Exit button in the stand-alone app takes the user to our Dynamics 365 page, which may confuse the user if they've never been to that page before and lastly, the Exit button in the web part on the modern SharePoint online page doesn't take the user anywhere, which is why I thought maybe hiding it would resolve my problem.

    Is it possible to code the Exit button so it takes the user in the mobile app back to the list of apps and take the user within the stand-alone app and SharePoint Online web part to the company homepage?  I'm not sure yet how leadership will want users to interact with the app so I'm just trying to cover all of my bases and have an answer for them if asked.

    Thanks again,
    Chad

    ------------------------------
    Chad DeCoteau
    Collaboration Specialist
    Fargo ND
    7014763191
    ------------------------------



  • 9.  RE: Auto Populating Employee Profile Information

    Posted Jun 03, 2020 04:06 AM
    Hi Chad

    I've never personally tried to do what you are doing and I'm not aware of an official way to do it, however I did stumble across a workaround that may help you with this problem.

    https://www.youtube.com/watch?v=ZWgYaV1VvAc

    Basically, using Set(varMobileDesktop, If(Location.Altitude > 0 Or Acceleration.X > 0, "Mobile", "Desktop")) will help to determine whether you are using a mobile device as mobile devices have altitude and accelerators in them and it's assuming that any device that doesn't register these items is a non-mobile device.

    So you could program your exit button to be on select:

    If(varMobileDesktop="Mobile", <your exit code>, Launch("https://www.companyname.com"))

    Hopefully that gives you the answer you are looking for. Please let me know how you go?

    Best wishes
    Damien

    ------------------------------
    Damien Rosario
    Knowledge and Training Coordinator
    ------------------------------



  • 10.  RE: Auto Populating Employee Profile Information

    Bronze Contributor
    Posted Jun 10, 2020 12:45 PM
    Hi Damien,

    That worked!  That' s really amazing.  Thanks so much!!

    I have one more issue I'm hoping you can help me with.  I'm trying to pass a value of "No" to a SharePoint list when a button is pressed and a value of "Yes" when a different button is pressed in the app. I then want to trigger an email based on that value in the SPO list.  It doesn't sound like a tough task but I can't get the function correct.  Any tips would be greatly appreciated.

    Thanks again Damien,
    Chad

    ------------------------------
    Chad DeCoteau
    Collaboration Specialist
    Fargo ND
    7014763191
    ------------------------------