Why am I getting this yellow warning message...

This is the error message I receive when attempting the "user" function not the a!user function:

The user function does not have a domain prefix....

  Discussion posts and replies are publicly visible

  • the user function does have a domain - it's fn!

    If you write it as fn!user() that message will disappear.

    Some context: these are the available domains:

    ...and it's now been deemed best practice to prefix Appian constructs with their respective domain.

    (just realized fn! doesn't appear in the above list, which seems to me an oversight! - I'll raise this with Appian Engineering)

  • 0
    Certified Lead Developer
    in reply to Stewart Burchell
    and it's now been deemed best practice to prefix Appian constructs with their respective domain

    Since when?  If this were the case, I'd expect that using the auto-fill rule picker in an expression/interface would populate the "fn!" domain like the "a!" domain is autopopulated - and at least as of 21.2, it isn't.

    Also, FWIW, i'm unable to reproduce the warning message as seen in the initial screenshots here - I wonder if there might be some other issue at play?  Or do some people have ultra-early access to 21.3?

  • Prefixing Appian constructs has always been informally a best practice (if that's not an oxymoron! - I always insisted on it when peer reviewing code) and if you use the function picker (fx) in an Expression Editor that does append the relevant domain prefix (in 21.1)

    If it's missing in the context you call out then I'd assert that needs to be amended.

  • ...I also should have said that what you're seeing is not an "error" but a "recommendation". Appian has put investment into building implementation recommendations into the platform to help developers delivery quality applications. You can see these kinds of recommendations appearing in the Designer tools (like the Expression editor) and also in the 'Health Dashboard' tab of the 'Monitoring;' view within an Application.

  • function prefixes are not always required. The expression editor warning will typically flag a function when there is a local variable or rule input with the same name. That's why 'user' is flagged but 'loggedInUser' is not

  • Hi Anne & Mike -- I'd like to provide some additional context. While the fn! domain prefix exists, and can be used for system functions, we do not enforce this as a strict best practice. We only enforce the best practice of using the a! domain for rules (which is why, as you rightly pointed out Mike, autocomplete in the expression editor automatically adds a!). 
    We recently had a bug where if you used BOTH a system function (such as user() or document()) AND you also had a rule input or variable with the same name (such as ri!user or local!document), then Appian would flag the system function as missing a domain. I believe that this is what you were seeing Anne.
    We addressed and removed this bug with AN-186789, available in hotfix 21.2.385.0. As such, you should no longer see system functions called with parentheses underlined as requiring a domain.