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
6 replies
Subscribers
8 subscribers
Views
2486 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
I have observed unexpected behavior for isusernametaken function. When we pass a
chetany
A Score Level 1
over 9 years ago
I have observed unexpected behavior for isusernametaken function. When we pass an empty string to it, it returns true.
As per my understanding this should not be the case. isusernametaken should return true for only the users which exist (activated/deactivated) in the system. This was observed on Appian 7.11
fn!isusernametaken("") - true
OriginalPostID-205763
OriginalPostID-205763
Discussion posts and replies are publicly visible
Parents
0
Shyam Bommakanti
Certified Lead Developer
over 9 years ago
fn! doesn't have side effects, meaning if should always return expected value. isusernametaken() is a bool, and think of passing null as divided by 0. What should happen, when your only possible return value is a number?
One of the purposes is you should be able to create users based on output of this function, if it returns false for null creating the user fails.
As @stefanh791 mentioned, use a wrapper to check for null.
For more context, from Appian common objects rule!APN_displayUser, it checks for null ahead, as I said earlier, fn! functions should have no side effects, so check for null and handle accordingly:
if(isnull(ri!user), "",
if(isusernametaken(ri!user),
user(ri!user, "firstName") & " " & user(ri!user, "lastName"),
tostring(ri!user)
))
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
Shyam Bommakanti
Certified Lead Developer
over 9 years ago
fn! doesn't have side effects, meaning if should always return expected value. isusernametaken() is a bool, and think of passing null as divided by 0. What should happen, when your only possible return value is a number?
One of the purposes is you should be able to create users based on output of this function, if it returns false for null creating the user fails.
As @stefanh791 mentioned, use a wrapper to check for null.
For more context, from Appian common objects rule!APN_displayUser, it checks for null ahead, as I said earlier, fn! functions should have no side effects, so check for null and handle accordingly:
if(isnull(ri!user), "",
if(isusernametaken(ri!user),
user(ri!user, "firstName") & " " & user(ri!user, "lastName"),
tostring(ri!user)
))
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data