In an application I am prototyping, I have an object called Message.User that inherits from System.User and effectively adds details of the user, such as first/last/full names, contact details, status etc. When I create a record in a Message.Message object I wish to store the Fullname of the user who created the record. I have an association between Message.Message and Message.User and if I set the default to [%CurrentUser%], the field on Message.Message is populated correctly. However, there is a warning that this functionality is being deprecated and I should replace it with an After Commit event microflow. I can't get this to work. My microflow retrieves the User object through the Message_User association, and does a change of the MessageObject to set the Message_User association to the retrieved User_Object - this doesn't work. I've tried changing the microflow to return the User_Object instead of the change action - also doesn't work. I tried changing it to return a string value and set that to User_Object/Fullname, and that doesn't work either. I'm sure there's a simple way to do what I want, but I'm just having to try to find it by trial and error. Can anyone point me in the right direction, or is there a sample application that can be accessed so we can see how microflows are used to do this and many other functions. Access to a complicated application to be able to examine the microflows would be a great learning tool in the absence of more detailed documentation. Additional info: I also tried simply changing the Message_User (association) item of the Message object to $currentUser, but that gives an error that the expression is of type System.User but should be of type <mymodule>.User
I am not sure wheter i understand the question correctly, but you try to retrieve the user by the MessageUser association in order to set the same association? Retrieving the user before setting the association will return empty, so you set it to empty again...
I think you just need to set the MessageUser association to $currentUser.
Updated according your update
Does Message.User specialize System.User? If so, i think you need an up cast as well.
I didn't find this microflow at all intuituve. Here is a screenshot of what worked
Hope this will help others
Your association Message_User is to Message.User, but you are trying to set a System.User object in it. First retrieve the Message.User that matches $currentUser and then set that in your association, like Michel also mentions.