Adding parameters to Microflow call from Java

2
Using this tutorial I tried to call a Microflow in a Java action. Tutorial code: private static String formatString(String inputString, IContext context) throws CoreException { Map<String,Object> parameters = new HashMap<String, Object>(); parameters.put("inputString", inputString); String formattedString = (String) Core.execute(context, "MyFirstModule.FormatString", parameters); return formattedString; }   Now I'm trying to call a microflow that needs and object as parameter, but I can't find how to pass it. I've tried: Map<String,Object> parameters = new HashMap<String, Object>(); parameters.put("Administration.Account", account); Core.execute(context, "Administration.MyMF", parameters); But this results in an empty Account in the MF, and I've checked in the Java, I'm passing a valid Account object (not empty)   I've also tried: Map<String,Object> parameters = new HashMap<String, Object>(); parameters.put("Account", account); Core.execute(context, "Administration.MyMF", parameters); This because the parameter is actually called "Account"  in the MF, however this results in an error: "Unknown variable type: class administration.proxies.Account"   So what's the correct way to pass my Account object to the MF?
asked
2 answers
4

If what you have is not a Mendix object, you should put the following:

parameters.put("Account", account.getMendixObject());

Otherwise, you can just pass the object:

 

HashMap<String, Object> parameters = new HashMap<String,Object>();
IContext systemContext = this.getContext();
for (IMendixObject object : objectList) {
	parameters.put(inputName, object);
	Future<Object> future = Core.executeAsync(systemContext, microflowName, true, parameters);
	futures.add(future);
}

 

answered
0

Hi Jelle,

As you parameter of account = Account? Could you please to use code follow:

account.getMendixObject()

 

Regards,

Peeradech (TBN Software Thailand)

answered