Searching by user ID on the user record

I was reading this link: https://docs.appian.com/suite/help/17.3/User_Management.html#-add-user-filters and didn't find the answer to my question. I would like to be able to search by user ID. Is there any way to do so?

  Discussion posts and replies are publicly visible

Parents Reply Children
  • The current workaround is user pickers, but these do not currently support searching for inactive users.

  • 0
    Certified Lead Developer
    in reply to John Stretton

    It is my understanding that deactivated users are intentionally excluded from user pickers because they are no longer active and can't have 'metadata' like tasks, etc assigned to them. So, if you need to give a list of all users (past and present), you might want to consider letting them pick them from a different source (integration to a diff systems, DB table, etc).
    Hope that helps

  • What if that could be a parameter for the user picker component, though? By default, only show active users (because this is what I want probably 80% of the time), but allow me to pass true() in some parameter if I also want to show inactive users.

    The most common use case for this is searching for historical records where the creator/assignee/etc is no longer with the company. I have a lot of applications like this, and sometimes I do have to pick from a different source. It can be confusing for users to see a user picker in some situations and this random other picker (that doesn't quite look or behave the same) in other situations.

  • 0
    Certified Lead Developer
    in reply to John Stretton

    In one of my projects, to solve this I created a "user picker from database" custom component (which uses the generic picker field paired with my Users database table), as it allows inactive users to be searched in a similar fashion to the OOB user picker, but to allow inactive ones to be returned (along with a label saying "(deactivated)" after their name).  This does require a "users" table to be created and maintained, but IMHO that's fairly essential for any project.

  • Are you willing to share the objects that you created to maintain that Users table? Would save me the trouble of creating them from scratch.

  • 0
    Certified Lead Developer
    in reply to John Stretton

    Sorry for the late reply - for whatever reason I don't think I originally got a notification of this so I only just noticed after the newer reply was added below.

    In general the user DB table can and should be fairly simple - with just enough to give you the control you need.  The fields typically involved that I've seen:

    • user ID (primary key for the DB table, integer, auto-generated)
    • username (text mapping to the Appian user's username)
    • firstName, middleName, lastName, nickname, email address -- these values would be duplicative of ones stored within the Appian User, but would need to be stored in the DB table and synced by your processes, especially due to the need to be able to search users by name, etc.
    • is_active -- boolean; set to 1 by default, and set it to 0 if deactivating a user
    • created_date, created_by, modified_date, modified_by -- "standard" columns that store the username and edit date any time a record is created or modified via your in-process tools.  These are optional but if you don't include these your O&M support personnel will probably hate you.  I'm in the awkward position of being O&M support on a project where I designed a few tables without these, and hate myself for it ;-)

    That's about all you would need - to support such a table, you would either need a process where admins can add/edit users via a front-end process, or at least a process that runs periodically and finds all current active user accounts in the system and syncs their data with the matching DB table entry, and creates one if none is found.

  • For a number of reasons, I don't think I want to require all user adding/editing operations to be performed through a separate front end. If you have already created a process that syncs user data with a table, are you willing to share that?

  • 0
    Certified Lead Developer
    in reply to John Stretton

    I don't have such a process at hand, but it shouldn't be terribly hard to create from scratch.  A few checklist items I can think of:

    1. Create a subprocess that handles all of the actual "work" involved
    2. Create a parent process that's launched by a timer, i.e. daily at 1 AM, calling the subprocess from step 1
    3. In the main subprocess,
      1. call the "get users from group" function on a group that you set up to contain all applicable [active] users (such as all users in the system, or all users that meet certain criteria) by rule; save an array (PV) of usernames or "user" type
      2. query all users from your DB users table (active and inactive), save into a separate PV
      3. check for 3 subsets:
        1. Appian user accounts that don't exist in the DB
          1. for these, create a new DB entry
        2. Appian user accounts that are in the DB but are marked as deactivated
          1. for these, the DB entry would need to be marked as active again
        3. DB entries that are marked as active but not currently found in the users array
          1. for these, the user has presumably gotten deactivated, so the DB entry would need to be marked as deactivated
      4. for the above step, i recommend feeding both the user array as well as db-queried CDT into one big expression rule which will then spit out a CDT array of just the needed changed DB entries (we're assuming that the Appian user accounts and their current states are the "source of truth").  This will make it incredibly easier to both develop as well as debug and test.
      5. Write all modified DB entries to the DB table.
    4. Optionally create an independent parent process that will also invoke the main subprocess but which can be kicked off by an admin, on an ad-hoc basis, if a midday update is needed, etc.  This will have potential performance implications (especially if there are tons of users) but could be helpful if there is an occasional urgent need to allow them to update the DB immediately after a user change.

    Let me know if any of that is unclear or if there are any other questions.  This was all off the top of my head so I may have glossed over something.

  • Makes sense, but this is one of those things that is unlikely to make it to the top of my to-do list if I have to make it from scratch. Also, don't you wish that there were a better way to handle scheduling processes to run on a timer?

  • 0
    Certified Lead Developer
    in reply to John Stretton
    Also, don't you wish that there were a better way to handle scheduling processes to run on a timer?

    I'm quick to call out Appian in areas that I feel they need to improve, but as far as pure use cases like running a maintenance process once per day overnight, I feel it's fairly easy to do once you get used to the necessary controls. 

    The one thing I wish we could do, though, would be to set up process triggers based on internal events (like, "run this process every time a user is created, updated or deactivated via any internal mechanism", which would negate the need for a timer in most cases).  But alas, I don't anticipate that happening any time soon.