Changing the object type

0
E.g. you have 3 entities: “Vehicle” ; “Car” ; “Train”. Both car and train are a generalization of “Vehicle”. Is the following scenario possible? : 1. Create an object of “Vehicle”. 2. Change the object type of the created object to “Car”.  
asked
3 answers
3

No; that is not possible using the Mendix defaults. I certainly believe that with JAVA you could do some fancy stuff.

But my approach instead of opting for java would be:

Create a microflow, which creates a CAR object, copy the data from the Vehicle object into the CAR and delete the Vehicle object.

 

answered
1

Yes, use the Cast action in a microflow.  Documentation can be found here:  https://docs.mendix.com/refguide/cast-object

**EDIT**

I guess I did not understand your question.  I thought with this domain model

You wanted to do something like this

But it seems thats not correct.  

What are you trying to accomplish?

 

answered
1

The easy way to do this is by using the Clone action from the community commons module like this:

All attributes are copied into the specialization and the MF removes the original Vehicle. Be aware that if you are using an autonumber on the Vehicle entity then this number will change as it is not possible to clone this. In that case you’ll need an additional field that holds this number.

answered