Send user input task to a particular user based on hierarchy

Hello everyone,

I have a scenario where if someone logs a request for new employee the request should go through multiple approvals 

First: The first approval will be from the hierarchy manager

Second: From the HR team

Now my roadblock is how can I specifically send the request to only the hierarchy manager, since all the users are created in admin console- how can I set the hierarchy for each employe and send the request dynamically to only their managers and not the whole manager group?

Thanks and regards,

Aishwarya 

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    You will have to manage this relationships somewhere. Either in the database, or the supervisor field in the user record.

  • 0
    Certified Senior Developer

    Hi Aishwarya,

    In this case, I suggest you build a new application  instead of creating the users from Admin Console and use the smart services available to create user and deactivate user.
    In this Process Model, you can have the manager and HR approval to be kept.

    Once they approve, then only the Create User Smart service should be triggered and user should be created.

  • 0
    Certified Associate Developer

    Hi Aishwarya,

    I suggest you can manage the hierarchy by creating user groups for the manager's and configuration as per your terms. Or you can write a rule to find the hierarchy manager for the Employee's and by using script task you can assign it in PM. I think by Creating Groups for the Manager's will solve your issue to be assigned as per hierarchy.

  • 0
    Certified Lead Developer

    On every User Input Task node there's a place to use an expression to decide who the task is assigned to.  Make that as complicated as you want or need.  Here's the great part, you code it separately as it's own independent expression rule, then when it consistently generates the user object of the very person who should get assigned every time, then stick it in the PM.  It doesn't need to involve groups at all.  It just needs to be the right user, however you want to define or store it.

  • 0
    Certified Lead Developer
    in reply to Dave Lewis
    Here's the great part, you code it separately as it's own independent expression rule

    Exactly what I came here to say - stick it in an expression rule, where you feed in one username (etc), and the rule spits out the appropriate user in return.  Assuming the current setup is done in such a way that you can use expression logic to take a username and figure out which Approval Manager to select (and if not, i'm not sure how or even if this is solvable anyway), that makes this VERY easy to test - just test on different usernames and make sure the results are all as expected.

  • 0
    Certified Lead Developer
    in reply to Harsha
    I suggest you build a new application  instead of creating the users from Admin Console

    I don't know how this is a useful suggestion.  Firstly since it shouldn't matter at all whether or not accounts were created from the Admin Console or in a process, and secondly (mainly), someone who would ask such a question here will almost always be in a situation where "just create a new application" is not even remotely feasible as a solution to their current issue.

  • 0
    Certified Lead Developer
    how can I set the hierarchy for each employe and send the request dynamically to only their managers and not the whole manager group?

    I second ' suggestion above, but my immediate follow-up question here is, how are you storing these individual relationships?  As Stefan noted, you'll need to track them somewhere in order for your system to procedurally trace from a user to their manager, etc.

    If each person is guaranteed to always have a distinctive (single) supervisor, you could use the "supervisor" field in a person's Appian profile; other systems might create a relational DB that defines the user hierarchy from a user to one-or-many supervisors (this would be more complex but would allow a lot more flexibility in certain ways).

    But you haven't specified what (if anything) you might already have set-up, which somewhat hinders our ability to provide meaningful answers to your question.

  • Hello everyone,

    Thank you for replying,

    I apologize for not specifying this earlier.

    So I have used the "supervisor" field in a person's Appian profile to store the hierarchy of each user.

    Is there a way I can make use of this in the user input task so that when the logged in user submits a task it is assigned to the logged-in user's specified "supervisor" only? 

  • 0
    Certified Lead Developer
    in reply to aishwaryap0266

    Others mentioned to use an expression rule to implement that logic. That's the way.