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 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.

Categories:
I have the same question (0)
  • Verified answer
    v-yutliu-msft Profile Picture
    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

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard