Skip to main content

how do i set the value in a user lookup field on a record to the current user with a table row action?

With The 5.10 release we fixed some issues with the Action Framework that make this possible. 

So if you have that version of Skuid (or later) installed from the Skuid Releases page  you should be able to follow along. 

Step 1:  Create a model for the current user - called “User”.  
- This model should be on the User object.
- It should include at least ID and Name in the fields. 
- It should have a condition that filters ID to be the ID of the currently running user.   See Image below: 
e84d4a5b34e9220490ac3e9c855295777759e35b.png

Step 2: Create a row action  on your table ( or mass action if you want to apply this to all rows selected) 
- Type should be “Run Multiple Actions” 
- Add one action to the actions list.  Type should be “Update a field on row(s)”
- Choose the model that drives your table,  the user lookup field  (I used OwnerId) and then use this value syntax:  {{$Model.User.data.0.Id}}

04a3d94090f9651f557ffd0202a6471a0e797ac8.png


Now whenever you select that row action - the Name in the User Lookup field will change - and will be highlighted as a pending change.  Push save and all will be good. 

The action framework would allow you to avoid the “save” step if you really trust your users with that power.  You could add additional action for “save model”  and the user would not need to push the save button on the page to have the change committed.  Powerful stuff! But maybe a little too scary…