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
10 replies
Subscribers
8 subscribers
Views
3499 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Hello, 1. I created a constant of type Group that has the value of al
mjmallet
over 9 years ago
Hello,
1. I created a constant of type Group that has the value of all active users in our company.
2. I created a rule to extract the username of all active users.
=joinarray(getdistinctusers(topeople(cons!active_user)),char(13)&char(10))
3 - I run this rule in a script and the list is saved in a text variable (multiple) and then sent to an excel spreadsheet.
I also got another rule to fetch the username of deactivated users.
=joinarray(getdeactivatedusersby("username","",2),char(13)&char(10))
How do I get the First Name, Last Name for my deactivated/active users? I've looked on the Forum for different solution but wasn't able to apply.
Thanks
OriginalPostID-150384
OriginalPostID-150384
Discussion posts and replies are publicly visible
0
rodgraham
Certified Lead Developer
over 9 years ago
Use the user() function to get properties of a user including first Name and lastName
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Poorna Guduri
A Score Level 1
over 9 years ago
Hi, PFA sample code. Hope it helps!!
sampleCode.txt
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
mjmallet
over 9 years ago
Thanks, does that code work in a rule?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Poorna Guduri
A Score Level 1
over 9 years ago
Yes, it will definitely work. Give it a try!!
The sample code that I've attached above helps you in finding out the first & last names of the deactivated users and you have to replace the function getdeactivatedusersby() with getdistinctusers() in order to get all the active users in your environment.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
mjmallet
over 9 years ago
Thanks.. :)
That got it working. I had to tweak your code to add the username, add comas. And then package it in a join array to save it in a variable to then have it displayed in Excel. ;) Now I have to tackle the French accents in Excel.. lol
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 9 years ago
@mjmallet Just in case, added to the above, if you are going to use the same code snippet or with slight modifications, as per my knowledge I would like to suggest to add the context local! because adding the rule inputs with the same name as local variables will cause readability issues (as there isn't a differentiation such as local! and ri!) and also the code behaves in a different manner if there isn't a context in case of same names being used for local variables and rule inputs.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
mjmallet
over 9 years ago
Thanks for the input.. where would you put the local! in the example provided above?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 9 years ago
@mjmallet We need to put in the load(). Here goes your snippet after applying the context:
load(
local!users: getdeactivatedusersby(
"username",
"",
2
),
local!usersWithNames: apply(
rule!fetchUsersWithFirstAndLastName(_),
local!users
),
local!usersWithNames
)
If you are new to using load() or with(), I would like to suggest going through https://forum.appian.com/suite/help/7.9/Evaluation_Functions.html.
Confirming the above, documentation conveys the same - 'When you don't specify the local! domain, the system first matches your variables with rules or constants with the same name, then looks for local variables with the name. Appian recommends that you always use the local! domain when referring to local variables.'
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
mjmallet
over 9 years ago
ahhh that's nice to know. We're slowly migrating to Tempo. So this is all new. Thanks! :)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 9 years ago
Great!! No problem :-)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel