How do I create a Microflow to change the status of the enumeration attribute, when an enumeration is in another entity.

0
So here is my question. - I am trying to make a microflow that changes the status of an order when I insert a date. - The microflow is about changing the order status when a date (for example: datesold) has been insterted. - I got 2 enities and an enumeration I am working with. Domain Model: On the overview page it shows the order with the status it has at the time. My problem is how do I create a Microflow to change the status of the order when, let’s say a date for “DatePaid” gets input. This should change the status to paid and when the Dateshipped gets inserted, this should change the status to shipped.   ( I know how to make the microflow when the status attribute is in the same entity as the dates, but is it also possible to do this when the dates and the status enumeration are in separate enities ?)
asked
1 answers
0

Hi Muhidin,

This domain model would suggest that Status is not a property of Orders. And that an order points to a specific status. If you really want to use this domain model you need the Microflow to retrieve from the database the object with the status you would like to set on the order and change the Orders_Status association and set it with the retrieved status.

However my suggestion would be:

  1. Make Status part of Orders (as an attribute, and remove the Status entity)
  2. Give it an default value (could be empty)
  3. Change the attribute Status when e.g. the DatePaid changes.

This is better because: if you accidentally change the Status object it would change the status for all related Orders, and that’s definitely not the behaviour you want. 
More in detail: let’s say you have 3 statusses: New, Pending and Paid defined in the Enumeration and you create an instance (a row) of Status in the database for each Enumeration value, the database would look like this:
ID | OrderStatus
1 | New
2 | Pending
3 | Paid
And the Orders entity refers to the Status entity which means they are related based on the id. Accidently changing object 1 | New to 1 | Pending would thus change all Orders related to 1 from new to pending. Since status is actually a property of Order I would suggest you place it on Orders, and once the DatePaid changes, this attribute is change via Change object in the save Microflow
 

 

p.s. off topic advice: Use singular, don’t use plural for entity names, use Order instead of Orders

answered