I am using function, user(fv!row.userName,"email"). In this if the username is null I am getting the error:
Expression evalution error at function 'user': [InvalidUserException]
Is there any way to put validation that if username is null then it should not throw error or show like no valid email ID
Discussion posts and replies are publicly visible
You can test to see if the User is null, and if not then call the user() function else return an appropriate value - that is use an if() statement!
Based on the error you are getting [InvalidUserException], looks like the data that is passed is not NULL but instead that username does not exists in Appian. If user name was NULL, it would have returned Null argument not allowed error. You can use a!usernametaken() function to check if user name exists before applying user() function.
https://docs.appian.com/suite/help/21.4/fnc_people_isusernametaken.html
if( or(isnull(fv!row.userName), not(isusernametaken(fv!row.userName))), "Not available", /*Return appropriate value if userName does not exists*/ user(fv!row.userName, "email") )