Bonita diagram-Prevent form submission based on condition

1
0
-1

Hello,

This is my scenario.

Employee1 of group A submits form. Manager1 of group A receives and approves/rejects form. Employee1 and Manager1 can be the same person. In my design, I have two lanes: Employee and Approver. In the Approver lane, I have a human task type which uses the actor defined in the lane, which is Approver. I've also set a custom actor filter.

Is there a way in the design to add an expression that says, if the submitter is also the approver, then do not allow the form to submit?

1 answer

1
+1
-1

This is always an interesting question, and one that can generate lots of ways of fixing it. And it's not just for Bonitasoft but for all other systems, how to do this when this is included in that.

One way is to add new code in your Approval Actor Filter to exclude Employee1 if they are the one that completed the request.

Another is to have the Manager of Employee1 approve the request (who is likely to be Manager1). This way they can still be in the same group but they are differentiated by corporate hierarchy. In doing this ManagerX, who is Manager1's manager will have to approve his request and so on up to the CEO.

When it is the CEO normally the Board would have to approve, and as the Board are not "employees" in this sense they don't request and will not, therefore fall into this trap.

regards
Seán

PS: As this reply offers an answer your question, and if you like it, please Mark UP or as Resolved.

Comments

Submitted by Michele.DuBose on Wed, 01/25/2017 - 20:59

Thanks Sean MCP for replying. Option 1 would be a better fit based on how my organization is set up. When you say add new code to the actor filter, I assume you're saying add custom code. I'm not familiar with adding custom code to an actor filter. Where would this be done, in the definition or the implementation? I understand that when you create a new implementation, the wizard automatically creates a stub of Java code. Is this where the custom code should be added? If so, how can I get to that java file with an existing implementation that's set up?

Submitted by Sean McP on Fri, 01/27/2017 - 06:03

Hi Michele,

Your custom (new) code would go in to the implementation.

Not sure what you mean by how can I get to that java file with an existing implementation that's set up? I would just copy the code and use it...

regards
Seán

Submitted by Michele.DuBose on Sat, 01/28/2017 - 15:57

Hi Sean,

Below is the stub of java code that was automatically created by the wizard when I created a new implementation called Test. I have implementations that are already a part of my process. To add custom code in the existing implementations, would I do it in the "Class Name".java file like the one below? If so, how to I access this java file?

`/**
 * 
 */
package org.mycompany.connector;

import java.util.List;
import org.bonitasoft.engine.connector.ConnectorValidationException;
import org.bonitasoft.engine.filter.UserFilterException;

/**
 *The actor filter execution will follow the steps
 * 1 - setInputParameters() --> the actor filter receives input parameters values
 * 2 - validateInputParameters() --> the actor filter can validate input parameters values
 * 3 - filter(final String actorName) --> execute the user filter
 * 4 - shouldAutoAssignTaskIfSingleResult() --> auto-assign the task if filter returns a single result
 */
public class testclassac extends Abstracttestclassac {

    @Override
    public void validateInputParameters() throws ConnectorValidationException {
        //TODO validate input parameters here 

    }

    @Override
    public List<Long> filter(final String actorName) throws UserFilterException {
        //TODO execute the user filter here
        //The method must return a list of actor id's
        //you can use getApiAccessor() and getExecutionContext()
        return null;

    }

    @Override
    public boolean shouldAutoAssignTaskIfSingleResult() {
        // If this method returns true, the step will be assigned to 
        //the user if there is only one result returned by the filter method
        return super.shouldAutoAssignTaskIfSingleResult();

    }

}`
Notifications