Solved

How to use fn-IsMemberOfGroup


Badge +3

Hello,

 

I want to show / hide some controls based on the membership of the current user. the group i need to check is different per item, i need to check it based on a property (CountryName).

 

When i put the fn-ismemberOfGroup function in the expression as fn-IsMemberOfGroup("Norway"), it works fine. when i use the following expression the item property is never used, fn-IsMemberOfGroup("CountryName") however when i user a Common property it works fine.

 

Further i tried to use the fn-IsMemberOfGroup("CountryName") using a rule but that didn't work out either. Is it possible to use this function with a rule or expression at run time and put in a dynamic group name?

 

208967_pastedImage_1.png

icon

Best answer by sanderomeijn90 10 October 2017, 22:24

View original

12 replies

Userlevel 7
Badge +17

Hi!

Try to remove quotes surrounding the "CountryName", so just: fn-isMemberOfGroup(CountryName)

Regards,

Tomasz

Badge +3

Unfortunately that makes no difference. with or without quotes it is not working.

Regards,

Sander

Badge +7

I confirm : if you set the GroupName manually, the function works well...if you retrieve it from Item Properties : doesn't work.

Userlevel 6
Badge +16

The function fn-isMemberOfGroup works with named/hardcoded groups. It doesn't work with names that comes from a variable

Userlevel 7
Badge +17

Hi ‌ if any from the above answers helped you with solving your issue, please mark one of them as "Correct", so that other users will be able to use it as a solution if they face a similar problem.

Regards,

Tomasz

Badge +3

When i use the common variable instead of a named/hardcoded groupname it works fine.

Do you know if it is on the planning to support the named controls or item properties?

Badge +1

What kind of column is "CountryName" in your list ? For me, it works with free text, on an on premise tenant.

Badge +3

The problem was not the column, the expression did not work on a multi line rich text box. So the function works fine but not on that specific control.

Badge +3

i added a new reply with the solution, it was not the item property but the control on the form that caused the problems..

Badge +1

Hi, 


 


Can we enter multiple group names here. I tried to do that by adding && which did not work.


 


Thank you in advance!


 


Regards,


Ronnie



@fhunth wrote:

The function fn-isMemberOfGroup works with named/hardcoded groups. It doesn't work with names that comes from a variable




 

Badge +1

I resolved this by using the And function from the Inline function tab.


 


Thank you again!


 


Best,


Ronnie.

Can you please share code how you got it working? I have created one form variable & set the value. But it's still not working by calling  fn-IsMemberOfGroup(variable Name).

Reply