Ignore User Role in microflow

0
I have a snippet that contains a list view (which is in a deferent module than the rest of the logic and has a general UserRole), on clicking the list view item I want to call the main microflow that will direct me to 1 of 2 other sub microflows (based on UserRole) to show a review page, I have 2 user roles that can use the Main Microflow, but there's no entity access for 1st UserRole in the 2nd mf and vise versa, is there a way to call the sub microflows without it seeing the UserRoles that was used to go into the main one just the one that will be going to that sub microflow?
asked
2 answers
0

I might be misunderstanding it, but why not just one microflow that can be called by both roles and then in the microflow check the user role of the current user and based on that call the different subflows? Or am I missing the problem here?

Regards,

Ronald

 

answered
0

I ended up using a custom Java Action

 

// This file was generated by Mendix Studio Pro.
//
// WARNING: Only the following code will be retained when actions are regenerated:
// - the import list
// - the code between BEGIN USER CODE and END USER CODE
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
// Special characters, e.g., é, ö, à, etc. are supported in comments.

package srv_eservice.actions;

import com.mendix.systemwideinterfaces.core.IContext;
import com.mendix.webui.CustomJavaAction;
import com.mendix.systemwideinterfaces.core.IMendixObject;
import com.mendix.core.Core;
import com.mendix.core.actionmanagement.MicroflowCallBuilder;
import com.mendix.logging.ILogNode;

public class JA_CallMicroflowWithoutUserRole extends CustomJavaAction<java.lang.Void>
{
	private final java.lang.String Microflow;
	private final IMendixObject Parameter;
	private final java.lang.String ParameterName;

	public JA_CallMicroflowWithoutUserRole(
		IContext context,
		java.lang.String _microflow,
		IMendixObject _parameter,
		java.lang.String _parameterName
	)
	{
		super(context);
		this.Microflow = _microflow;
		this.Parameter = _parameter;
		this.ParameterName = _parameterName;
	}

	@java.lang.Override
	public java.lang.Void executeAction() throws Exception
	{
		// BEGIN USER CODE
		
				if (this.Microflow == null || this.Microflow.isEmpty()) {
				    throw new IllegalArgumentException("Microflow name cannot be null or empty.");
				}

					Core.getLogger("Dashboard").info("Microflow: " + this.Microflow);
					if (this.Parameter != null) {
					    String ApplicationNumber = (String) this.Parameter.getValue(this.getContext(), "ApplicationNumber");
					}

					if (this.Parameter != null && this.ParameterName != null) {
						com.mendix.core.Core.microflowCall(this.Microflow)
						.inTransaction(true)
						.withParam(this.ParameterName, this.Parameter)
						.execute(this.getContext());
						return null; 
						}
					com.mendix.core.Core.microflowCall(this.Microflow)
					.inTransaction(true)
					.execute(this.getContext());

				return null; 
		// END USER CODE
	}

	/**
	 * Returns a string representation of this action
	 * @return a string representation of this action
	 */
	@java.lang.Override
	public java.lang.String toString()
	{
		return "JA_CallMicroflowWithoutUserRole";
	}

	// BEGIN EXTRA CODE
	// END EXTRA CODE
}

 

answered