Microflow should have one parameter of type App.project

0
Hi all, I'm having this issue and i can't figure out why i get it nor how to solve it. I'm not to familiar with Mendix but ill give all the information i think that is needed. Modeler: 7.6.0 My domainmodel looks like this: 3 entities: Employee  -  Projectgroup  -  Project Now i want to do the following: After commit on project i want to loop trough all employees in the projectgroup. So on the domainmodel entity Project i made a handler: After commit and Pass event object is set to Yes. Now, in my microflow i included all 3 entities. I retrieved the list of employees being part of the projectgroup. And in a loop i'm changing 1 field of all employees that are part of the list.   Seems logical to me, but my modeler disaggrees ( :) ) I get the following error: "Microflow should have one parameter of type App.Project" How can I pass on a parameter? (I thought i did this by selecting Yes in the pass event.) Thanks!      
asked
3 answers
1

Hi Mark,

you can only use parameters matching the type of the trigger.

So a microflow triggered from a page can only pass the available entity of that page. A microflow used as event handler only the single object of the related entity. 

In you microflow; I guess the Medewerker parameter is not accepted. As far as I understand, this microflow is triggered from a page containing a single Project object or it is used as event handler at the entity Project.

If you need the Medewerker object as well in the microflow, you need to retrieve it. Either by association of Database, depending on the relation between Project and Medewerker.

Overview of available input parameters:

Data view 
- Single object of same type as data view

Nested data view
- Single data view object
- Nested data view + single data view object of enclosing dataview

List widget 
- Single object of same type as list(selection) 
- List of objects of same type as list(selection)
- List of objects of same type as list(all pages)

Nested list widget
- equal to single list widget
- + single data view object of enclosing dataview

Event handler
- Single object of entity

Some additional advise:

  1. Don't commit in a loop
  2. Don't use commit without events (unless it is really, really needed, which is not the case here)
  3. No need to use a separate commit event if a change is executed, you can commit directly in the change (if the change is done out side a loop, see point 1)

 

answered
0

Parameter are the white arrow like shapes in microflows.

https://modelshare.mendix.com/models/59662d56-919c-4418-af3e-9f1be553005a/microflow
A Before Commit event handler only expects the object it's handling, so in this case just the 'project' object.
You could have one parameter 'project' and then retrieve the associated objects over association in the BCO event, however in your case I would not use an event handler at all. You should create a microflow that does all the logic you want it to do (that could include committing other objects) and then just commit the project-object.

answered
0

answered