Downcasting from System.User (or other objects)

7
I'm trying to downcast a System.User object to an inheriting class. I know that I can use the inheritance split in microflow, but after that I haven't access to the inherited object. So, how can I get the inherited object as a variable to use it?
asked
3 answers
5

The first activity after the inheritance split should be a cast activity. You can find this activity in your connector or under the right click option 'set type of action'. When you open tab 'Object' you see the cast activity. In this cast activity you can edit the name of this object. It automatically captures the type of object that is associated to the sequence flow.

The order will be: inheritance split, sequence flow where you can set the type of object, cast activity.

A good thing to remember in case you have multiple object types: it always follows the most detailed sequence flow. So, if you only like to use/change one inherited object type you need one sequence flow with that specific object type and a sequence flow with the superclass (and one empty sequence flow of course). The other inherited object types will use the sequence flow of the superclass.

answered
1

You first need to cast the outgoing object from the inheritance split. Then you can use the variable name you gave it.

answered
1

Marco is right, you need to cast after the inheritance split to be able to use the downcasted variable in the rest of you microflow though

answered