if( and( not( rule!APN_isBlank( ri!userId ) ), isusernametaken( ri!userId ) ), proper( concat( { user( ri!userId, "firstName", null ), " ", user( ri!userId, "lastName", null ) } ) ), if( isnull(togroup(ri!userId)), ri!userId, group(togroup(ri!userId), "groupName") ))
Discussion posts and replies are publicly visible
The "CR" prefix appears to be included in the actual Group Name, when the rule's input is a Group rather than a Username. So, why not change the Group Name to not include that prefix, if it's not wanted in the group name output? If this is not sufficient, can you go more into detail as to what it is you're trying to achieve here?
Also as an aside, I'm unclear why it was necessary to include all 30-plus lines of code here (though, thanks for using a Code Box at least). AFAIK the only relevant line of code here is, "group(togroup(ri!userId), "groupName")", which is just the normal use of the "group" function to return a Group's Name.
I want group name as exactly the same thing, But while printing out the group name prefix should be removed
I believe you wanted to show this group name in interface , As the return type of your code is just a text , why don't you just replace the CR using appian function ? or you have some other requirement?
how can i do that
If it'll be a standard convention within your system that all group names will have the prefix "CR", but you want those group names displayed to end users without the "CR" prefix, you should create an expression rule that is specialized for your system's purpose, wherein you pass a group name (or maybe just the group object itself), get the name, and remove the "CR " text from the beginning. This is easy to accomplish using standard Appian Text Functions. An easier example that comes to mind would look like this:
replace("CR My Group", 1, 3, "")
Here we take "CR My Group", take the First through Third characters of the name, and replace them with a blank character.