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

Called variable not responding

Hi,


I have created an App and want deny access for some Azure user groups.

In the 'App - On Start' I pasted the following code:
Set(varUser, Office365Users.MyProfileV2().mail);
Set(isUserMemberTeamInc,varUser in Office365Groups.ListGroupMembers("d9add382-9c50-4231-957e-3566c6b1241e").value.mail);
However when open a form and paste underneath a 'button - visible' this code:
Not(Parent.Printing) || isUserMemberTeamInc
Because the user is not a member of 'isUserMemberTeamInc' the button should not be visible.
Please inform me why the variable is not responding.

Kind regards,
Jan
Netherlands

1 ACCEPTED SOLUTION

Accepted Solutions

The issue continued due to different usergroups pointing to the same 'VarUser'

I changed this by creating for each usergroup 'VarUser'.

Now all is working accept the combination with hiding the print the button when start printing.

But as workaround using the disable option is accpetable.

 

Thnx again for all the help!

View solution in original post

7 REPLIES 7
Pstork1
Dual Super User
Dual Super User

There are two potential issues here.

1) In is not a delegable function and ListGroupMembers only returns a maximum of 1,000 users.  So if its a really large group you search may not work.

2) Rather than trying to get the email from the profile I would use the following.

Set(varUser, User().Email);

 

I tested and this works if the group is an O365Group, not just a security or SharePoint group.  Also, not sure what the Parent.Printing might resolve to in your app.  Since its Or that will override the group membership for removing the button.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Sory but this does not work either

When the statement is not used in a variable it gives data in return.

error:

OfficeKundig_0-1618235372476.png

 

You'll get that error until you run OnStart the first time because there is no variable yet.  But, It works for me.  Here's the OnStart

 

Set(varUser, User().Email);
Set(isUserMemberTeamInc,varUser in Office365Groups.ListGroupMembers("6c2b508e-b774-44ca-859c-de8ce7be96b4").value.mail);

 

Here's the Visible and DisplayMode for two buttons. DisplayMode is easier to see..

 

isUserMemberTeamInc

If(isUserMemberTeamInc,DisplayMode.Edit,DisplayMode.Disabled)

 

And here is what it looks like if I'm not a member of the group.

image.png

Logged in as E1test who is not a member of the group.  The one button is invisible and the other is disabled.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

OK it seems the variable is recognized and the I can not use the icon instead.

But is it possible to combine the Not(Parent.Printing) with making the button hidden for none isUserMemberTeamInc

users?

 

thnx

Jan

Oeps!

It seems the button is now all time disabled no matter what user account logs in.

I double checked the GroupID's and they are correctly configured.

Really strange this working on your end.

 

Sincerely,

Jan

1) Is it an Office 365 group?  That is the only kind of group that the connector will work with.

2) Try removing the Not(parent.printing).  Not(parent.printing) is always true unless you are currently printing the screen.  Since you are using an 'or' it will always be true.  If you remove it temporarily you can verify that the variable works before trying to add printing in.  Do you want the button to disappear when printing or appear?



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

The issue continued due to different usergroups pointing to the same 'VarUser'

I changed this by creating for each usergroup 'VarUser'.

Now all is working accept the combination with hiding the print the button when start printing.

But as workaround using the disable option is accpetable.

 

Thnx again for all the help!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,961)