Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
9 replies
Subscribers
5 subscribers
Views
2475 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Plug-Ins
Hi, I am new to Appian. (Appian 7.6) Question about People Functions
batirbekm
over 9 years ago
Hi, I am new to Appian. (Appian 7.6)
Question about People Functions plug in.
I have an expression rule/function getgroupsformemberuser(ri!username). I believe this will return Group ids of that user (example: test: username: jsmith output: Group:[xxx]). So, this function gets list of groups user belong to. I would like to pass multiple usernames as an input. (example: test: username: jsmith; asmith; bsmith; output: Group:[xxx];Group:[xxx]; etc. Is there any way to do this?
Thanks
OriginalPostID-156905
OriginalPostID-156905
Discussion posts and replies are publicly visible
0
Josh
Certified Lead Developer
over 9 years ago
you can make use of the apply function inside your rule. ex. fn!apply(fn!getgroupsformemberuser(_), ri!listOfUserNames_user)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
batirbekm
over 9 years ago
Thanks joshl!!! I tried to use apply function and it returns first user's group id. test: asmith; bsmith; output: only returns asmith's group ids. Any other ideas?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Josh
Certified Lead Developer
over 9 years ago
This works for me: "apply(getgroupsformemberuser(_), ri!users)" Is your rule input defined to be multiple? Are you doing anything else in your expression rule?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
batirbekm
over 9 years ago
Rule input defined to be multiple - yes! No, I am not doing anything else. I see, I am using Type: Text not User. My output from my previous node is type text. I need to convert text to user object and then use this function.
Thank you again for your help, joshl!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Mike Schmitt
Certified Lead Developer
over 9 years ago
If you have a variable containing multiple users (ri!users for example) - off the top of my head, you can do this easily using apply() functionality, such as:
apply(fn!getgroupsformemberuser, ri!users)
As a basic explanation, the apply() function takes another function and calls it once for every member of an array you feed it; the output is another array containing the results.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Mike Schmitt
Certified Lead Developer
over 9 years ago
(above is an example of what happens when you don't refresh a forum post before typing out an answer, LOL...)
to confirm, I just tried this functionality using a text array (containing usernames) instead of a user array, and it appears to still work. Is it still not working for you? If not, maybe you can post some example code here?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
batirbekm
over 9 years ago
Yes, here is a sample code:
parameters: username, type text, multiple.
apply(fn!getgroupsformemberuser, ri!username)
Test: jsmith; asmith. Output: only returns jsmith's group ids.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Mike Schmitt
Certified Lead Developer
over 9 years ago
When I test the same code in expression editor (using 2 valid usernames separated by a semicolon and no space), i get both users' groups appended to one long list of groups. I'm not sure why it wouldn't be working in your case but you might try checking to make sure nothing's been overlooked.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
batirbekm
over 9 years ago
Bah! It is working. I had space after semicolon! Thank you mschmitt! :)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel