cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper II
Helper II

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

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

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,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Community Support
Community Support

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,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Solution Authors
Top Kudoed Authors
Users online (67,628)