How to design bpmn for leave managment system

I want bpmn diagram for leave approval system ,if no of days is 2 then only hr should approve if its more than 2 days both hr and manager should approve

Hey @Lavanya_U,
in the Modeler of Camunda Platform 8 SaaS there is a template similar to what you are looking for.

It looks something like this:

I think you could easily adapt this model to fit your use case. :slight_smile: Let me know if you need further help.

The example template is not enough,
I am able to get approval from either manager or hr. but i want after hr it shd go to manager if days is greater than 2

So, what I’m hearing:

  1. Employee Requests Time Away
  2. System Calculates “Business Days Away”
  3. HR always approves / denies request
    1.If denied, end process
  4. If Business Days Away > 2, then
    1. Manager approves / denies request
    2. If denied, end process
  5. If not yet ended, request is approved

Based on that, you would have:

  1. User Task: Employee Requests Time Away
  2. Script Task: System Calculates “Business Days Away” (Set Variable BusinessDaysAway)
  3. User Task (Second lane? Candidate Group: HR): HR always approves / denies request (Set Variable HRApproved)
    1. Exclusive Gateway (HRApproved = False) If denied,
    2. End Process: end process
  4. Exclusive Gateway (Business Days Away > 2) If Business Days Away > 2, then
    1. User Task (Third lane? Candidate Group: UserManager) Manager approves / denies request (Set Variable MgrApproved)
    2. Exclusive Gateway (MgrApproved = False): If denied,
    3. End Process: end process
  5. End Process: Approved Time Off

if its >2 Hr should also approve along with manager

Sorry… I laid out the process the wrong way round.
Switch HR and Manager throughout.
That will result in the Manager ALWAYS needing to approve it, and HR needing to approve if the leave is > 2 business days.

okay thanks ,got it . I had one more issue my filters are not working if you could help me with that it would be really helpful

This is the model I have designed for yes its giving an error

Between “MgrApproved?” and “Days > 2?” you don’t need another exclusive gateway.

What is the error it’s giving?

Each of your “Not Approved” and “Approved” should be “Process End” (Dark Ring)
If your attached forms for the User Task “(Manager) Approve Leave Request” sets the variable “MgrApproval” to “Yes/No” then your flows from “MgrApproved?” would have ${MgrApproval==“Yes”} as the condition.

Between manager and no of days if i dont have gateway how to specify the condition for no of days ?can we use and condition in between.
The no part when manager approves its working properly but when i give yes ,te error says boolean not expected string is expected

The diagram presented is also missing the script task to “Calculate Business Days Away” and set that variable.

User will need to determine how that is done… that would not be Camunda workflow.
But something like Temporal Samples | FEEL-Scala might help.

Did you try ${MgrApproval == true}

Hello,I am having a doudt how to call rest api using spring boot but without adding camunda dependency

Hi @Lavanya_U,

It seems the initial post has been resolved. Please create a separate post for any new topics.