Changing value in lookup to current user via table action

  • 1
  • Question
  • Updated 4 years ago
  • Answered
  • (Edited)
how do i set the value in a user lookup field on a record to the current user with a table row action?
Photo of Will Soupcoff

Will Soupcoff

  • 734 Points 500 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
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: 


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}}




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... 
(Edited)