How to delete objects based on an attribute value

0
I want to make a microflow that deletes a customer if they have a specific attribute value (enumeration). I already try to make a microflow but this microflow does not work. I made an exclusive split with this attribute value. If they have this value then the activity delete object deleted the customer. This microflow does not work for some reasons. The problem is that if I click refresh in clients on then all the customers are deleted, and if I do not click this option on then no customers are deleted. Another option is maby to retrieve a list of customers with this attribute value and then activate the delete activity? But I don't know how to retrieve a list of customers only with a specific attribute value.
asked
5 answers
0

There are (at least) two ways to make such a microflow:

  • In a Data Grid of Customer entities, add a microflow to the control bar. This microflow has a single input parameter of type Customer. In an exclusive split, you can check if this Customer object has the proper attribute value ($Customer/Attribute = modulename.enumerationname.enumerationvalue). If you, delete the object, if not show a message to the user.

  • You can place a microflow trigger anywhere for a microflow that has no inputs. Then, you use a Retrieve action to retrieve Customer objects, with an XPath constraint, like [attribute = 'enumerationvalue']. Then you add a delete action which deletes all of the retrieved objects.

Remember that you have auto complete if you press ctrl + space, to help you get the syntax right.

answered
0

Are you sure that the other options of your exclusive splits DON'T delete the customer? Should probably look something like this: alt text

answered
0

"But I don't know how to retrieve a list of customers only with a specific attribute value."

Use an xpath constraint on the attribute (see https://world.mendix.com/display/refguide4/XPath+Constraints)

answered
0

Here you see the picture(link) of my microflow. I think the problem is that the microflow now deletes a random customer instead of that customer with the specific value . http://postimg.org/image/5mp8x6ldn/

answered
0

I want to do the second method, without any inputs. I made an microflow that retrieves the list of customers with this attribute value, but in the delete activity I have to choose a variable which is not available now(I only retrieve a list of the customer). How can I solve this problem?

answered