{{{$User.userId}}} displays Salesforce Id instead of name

I’ve had this problem before and have worked around it in some cases. When auto-populating a reference field in edit mode through an action, the field populates with the Salesforce ID instead of the reference record’s name. In my current use, I want to have a task that can be assigned to other users as owner. It works as planned except that I want the owner field to prepopulate upon page load with the userId of the current user. They can then change that to another user if they want to assign the task to others. The problem is that when the field populates, it populates with the Salesforce user ID instead of the userID. I tried triple Mustache, global merge variable for user and creating a model on the user object and pulling the userId from there. All have the same result: Salesforce Id instead of UserId. It does work, but it looks sloppy to the user having a jumble of numbers and letters in the userId field. Anyone have any suggestions?

This worked for me:

New {{Model.label}}


Thanks Irvin, but I still get Salesforce Id displaying. Anyone know any model confilcts or settings that may cause this? I have 25 models on this page, so there is plenty of room for conflict.

Raymond.  This trips lots of people up. 

You are creating new records and want to prepopulate a reference field.  You pass the ID in,  either as a condition or as a prepopulation (in the create new row action) or as a subsequent field update action. What do you find:  Just the ID… Boo… We all want the name! 

The problem here is that we don’t have a real salesforce record yet,  we don’t automatically run a queries on the user object to retrieve the name that matches that ID.  Without the data in the model, all we’ve got is the name! 

The solution here is add a second line to your pre-population where you force the name into the parent object.  See below how I’ve done it for tasks. 

Then the name value is in the model and can be displayed. 

Can’t show what you don’t have…

Ha! Glad I asked. Works like a charm. Thanks!