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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Set multiple variables...
Power Apps
Answered

Set multiple variables in OnStart of App in a canvas app base off of values in Edit Form

(0) ShareShare
ReportReport
Posted on by 160

In OnStart action of my App I need to check if the user is in a particular AzureAD group and if a DataCardValue is blank, then set a variable to true, false.  A screenshot of my code is as follows with a ton of errors.  I am not sure what is wrong.  (NOTE:  I know that I am missing the Id of the AzureAD group, they will be created tomorrow).  I need to use these variables to then set some fields to DisplayMode.View and a variable varFormTab in the Edit form to "Hiring Manager".  I think the variable varFormTab needs to be "initialized" in the OnStart at the beginning of this code.  Any help would be appreciated.

GetUserAADPowerAppsScreenshot.png
Categories:
  • Verified answer
    v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @GoGorilla ,

    1)AzureAD.CheckMemberGroupsV2()will return a table , not boolen.

    If this user is in this specific group, it will return a table with this group's id.

    If this user is not in this specific group, it will return a blank table.

    So if you want to justify whether a user is in this specific group, you need to use IsEmpty function.

    Formula like this:

    IsEmpty(AzureAD.CheckMemberGroupsV2(User().Email,["groupid"]).value)

    If you are in this group, it will return false. If you are not in this group, it will return true.

     

    2)Try to modify your formula like this:

    If( And( IsEmpty(AzureAD.CheckMemberGroupsV2(User().Email,["groupid"]).value), 
     IsBlank(EmpTypeDataCardValue8.Selected.Value) 
     ), 
     Set(varContractHM,true), //user is not in that group and the selectedvalue is blank
     Set(varContractHM,true)
    );
    If( IsEmpty(AzureAD.CheckMemberGroupsV2(User().Email,["groupid"]).value), 
     Set(varHirMgr,true),Set(varHirMgr,false)
    ) //if user is not in that group, then the variable will be true
    ;....//modify others like above

     

     

     

    Best regards,

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 330

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard