Employees should only be able to see the leaves that are applied by them.

Hi experts, I am building a leave application system. I want to see only leaves that is applied by the employee. Please help me execute this. My domain model and microflow that i currently build in the screenshot. I retrieve account info and changed in leave object and try to add access rule for employe in leave entity, then no records are visible for me.   I believe  [Leave.Leave_Account='[%CurrentUser%]'] Xpath can help but when I use this I am not able to get Current user. I am getting error. Please help me with the same            
2 answers

Hi Harsh,


You are setting the Leave.Leave_Account association when creating the object, but using the Leave_Employee/Leave.Employee/Leave.Employee_Account association in your entity access.

When creating the Leave object, you have to connect the Leave object to the Employee object.

This way you can access the Leave objects connected to the employee.


Hope this helps!


PS: The Leave_Account association is unnecessary if you are retrieving the Leave objects over the Employee.


Hi Harsh, I'm not fully understanding your question, do you mean you are not able to retrieve the account in the microflow? 


First thing to do is set the association between Employee and Account to 1-1. If it's the case that an account can have multiple employees associated with it you need to determine how you can find the correct employee but I'm assuming it should be 1-1. 


After that, in your MF you can retrieve Account like this: 


When you've changed the association you can retrieve the employee by association and create a new leave.