How to set validation via Microflow

0
I have following situation - I have two entities allocation and resource in which I want to allocate a resource between the following date- start date and end date and I want to write a validation if someone wants to allocate that resource in between the last allocated dates the validation will be fired
asked
1 answers
0

Hello Shirjay, 

 

To validate this you can create a validation microflow and build there your specific logic for validating.

 

Please checkout this learning path: 

 

https://academy.mendix.com/link/modules/95/lectures/784/8.3.2-Build-Validation-Checks 

 

 

In your case you need to know if the resource is not already occupied to an allocation with a start and end date: 

 

- probably you need to retrieve if there is already an allocation for the resource on the given dates

- you can use a database retrieve action and within your xpath you need to make sure you only retrieve the associated objects of allocation to resource, furthermore you need to specify your date requirements, probably something like this:

 

Associated with resource

and

currentAllocation/startdate <= Enddate 

and 

currentAllocation/enddate >= Startdate 

 

- if that returns empty you have a valid allocation if this is not returning empty then you have a conflicting allocation 

 

Good luck!!!*

I hope it helps

 

 

answered