Confiform: Filter on multiselect user field

Amir August 24, 2021

I have a field that its type is "user (multi-select)" and I want to set a filter (or condition) on another field (For example, IF Match view helper) that if current logged in user is one of the users I define on the user multi-select field, sth happened (For example show sth). How could I set the filter?

@Alex Medved _ConfiForms_ 

1 answer

1 accepted

0 votes
Answer accepted
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 26, 2021
Amir August 26, 2021

Is it true when "myuserfield" has multiple users?

Totally, How could I set the condition/filter fields, when I want to search in a range or in an array and if "my_value" exist in that array return true?

Amir August 26, 2021

I mean Something like "IN" and "NOT IN" filters in CQL sentences...

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 26, 2021

Is it true? Well, you can check yourself... add a multi-user field, add yourself and create a filtered view over that field with the argument set as in my previous comment.

Sorry, I dont understand your second question

Like Amir likes this
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 26, 2021

Check more on ConfiForms filters here https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Filters

! defines NOT in the filter

!myuserfield:[entry._user]

will check if the user not exists in the multi-select user field

Alex

Like Amir likes this
Amir August 26, 2021

I ask because I test this before and I couldn't succeed. So let's explain more. I have a field named "Authorized_Users" that save multiple users like "A, B, C, ..." and I have a variable like X that every time changed (for example it is the current logged in user).

I want to set a condition that if X (that is current logged-in user or "_user") exist in Authorized_Users, show something. For this situation, I found nothing in your filter examples.

I can write filter in 2 ways:

1. Authorized_Users:[entry._user] > In this way [entry._user] is the user that submit the form, not logged-in user

2. _user:[entry.Authorized_Users] > in this way the output is sth like this: X:A,B,C

and this filter is wrong. Because 1 value couldn't be equal to 3 value! So here I should have sth like "IN" and "NOT IN" filter to use instead of ":" to search in multi-values fields, or ":" should work as a "search" function, not only "equal" comparison.

I hoe I had explain clearly.

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 26, 2021

Well, ConfiForms is smart enough to understand what type of field it is checked against and for multi-value fields it does automatically "contains"

Screencast to illustrate what I was saying...

http://recordit.co/ZR0d6d27m3

And as I have said earlier you can create a view to list rows that dont contain current user in a field

!multiuser:[entry._user]

Alex

Like Amir likes this
Amir August 27, 2021

You mean that these conditions both return "TRUE" ?

user1:user1,user2
user1:user1

 I ask because it didn't work for me.

I explain again. One side of my filter is "_user" that return current logged-in user that are viewing the page

other side is [entry.authorizedusers] that its output is sth like "user1,user2" that is authorized to view the contents in IFMatches macro

But when I write _user:[entry.authorizedusers], it didn't work.

 

Another question; Is it different between _user:[entry.authorizedusers] AND [entry.authorizedusers]:_user ?

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 27, 2021


No, I have not said that.. and neither the _user:[entry.authorizedusers] AND [entry.authorizedusers]:_user makes much sense (really, does not make sense at all)

 

Please see HOW I use the filters... there is a screencast that shows you that... I also put examples... why do you switch over to something else!? I cannot understand that

Like Amir likes this
Amir August 27, 2021

Because I don't want the user who fill the form. I want to filter another users that defined in another field and compare them with the user who are viewing the page.

[entry._user] is the user who submit the form and its username is "X". While submitting the page, there is a field (authorized_users) that automatically filled and assign some users (Like A & B) from another form depending on category that user X select. When form submitted, a page is created and another user with username "Y" is viewing the page. I want that if "Y" is one the users that had assigned in authorized_users field, see some text or some fields. So I can't use [entry._user], because this is the user who filled the form, not the one who is viewing the page! Is it true? If yes, so multiuser:[entry._user] couldn't be correct filter for this situation.

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 27, 2021

[entry._user] variable holds the user who is currently logged in

It is documented in the link I have shared with you in my initial reply https://wiki.vertuna.com/display/CONFIFORMS/Accessing+field+values+and+properties#Accessingfieldvaluesandproperties-Additionalvaluesavailableinthecontext

Like Amir likes this
Amir September 6, 2021

Hi again

I Have a IFTTT form that create page on submitting form. In created page there is an "IFMatches View Helper" macro that it's condition is sth like this:

A_Multiuser_Field:[entry._user]

That means if logged-in user is a member of "A_Multiuser_Field" then that user can see some texts.

But when page created, [entry._user] has changed to the userrname of form submitter and I cannot trigger the logged-in user in condition field. Could you help me how could I trigger logged-in user without [entry._user] or do sth to prevent changing [entry._user] to creator of record and page and this field remain without changes. Thanks

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 6, 2021

Hi

That is because the [entry.field_name] notations are evaluated in your templates against the current record's data

To bypass/workaround this, you need to use asEntryRef virtual function

 

See https://wiki.vertuna.com/display/CONFIFORMS/Virtual+functions

 

Alex

Like Amir likes this
Amir September 6, 2021

Yess. This is exactly what I needed. Thanks a lot

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events