Problem using table row data from one model in action "Update a field on row(s)" on another model

  • 1
  • Problem
  • Updated 2 years ago
  • Not a Problem
I've a junction table I'm trying to add rows too. I can add a row to it. I can add the data for one of the two master-detail fields using {{$Model.....}. Trying to add data from the current into the other master-fields using {{Id}} for the other master-detail field. Fails using this merge and it's driving me crazy! It enters an incrementing number each time I try it! 
See youtube video.

http://youtu.be/PXgjh3RpOqg 
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Moshe Karmel

Moshe Karmel, Champion

  • 8,646 Points 5k badge 2x thumb
Great video by the way! I have a couple of theories.
1) Try using {{{Id}}} instead of {{Id}} (triple instead of double, I don't know why but sometimes that helps)
2) I have a lot more experience writing Javascript snippets for skuid, but whenever I'm updating a lookup field, I usually have to update the Id as well as the related name, in order for it to display correctly. Although I don't think you should need that here because you're saving right away.
3) You are assuming that {{Id}} will automatically reference the row in context but I'm not sure that that happens automatically. I think one of the newer releases of skuid had a way to set that as a condition or something.

BTW the reason you see 1, 2 and 3 as the Ids, is because skuid assigns a temporary Id to every new row in sequence of 1,2,3 etc.

If you want to use Javascript I can help you with that, but using actions I would double check that all of the fields that you are using are actually selected by the models that reference them. I think all of the skuid people are at Dreamforce so you might not get a response right away.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Ok, you need to make sure you have the latest version of Skuid installed in your org, because we added a function to the "create new row action"   Go to skuidify.com/skuidreleases for the goods. 

After you've done this,  you will notice a new icon next to the "Create new row"  that lets you create default values for the new row.  The problem is that previously when you created a new row,  the context was being passed to the new record instead of what you had on the table.  This is why you got the incrimental numbering. 

The other prepopulation worked correctly because you were using the global model merge syntax and populating the same data every time.  

Create default values for the ID field.  All will be good. 



Notice the indentation below create new row. 
Photo of Henry Goddard

Henry Goddard

  • 776 Points 500 badge 2x thumb
Is it possible to create multiple rows from a row action?

I'm able to make the first row, however if I try another 'Create new row in Model' I'm unable to save the model.

Echoing out the model rows to the console shows that the AccountId and OwnerId will only be applied to the first row.

Thoughts on overcoming this?
Photo of Karen Waldschmitt

Karen Waldschmitt, Official Rep

  • 8,260 Points 5k badge 2x thumb
Henry~

I'm not totally clear on what you are trying to do but have you tried using a drawer to accomplish this?

Hope it works for you!
Karen
Photo of Henry Goddard

Henry Goddard

  • 776 Points 500 badge 2x thumb
Hi Karen,

I've taken a course of action that no longer incorporates my issue. If I experience it again I'll be sure to add some screenshots and make a more thorough explanation. 

Thanks
Photo of Karen Waldschmitt

Karen Waldschmitt, Official Rep

  • 8,260 Points 5k badge 2x thumb
Henry~

Glad you were able to figure out a way to get things to work for you!

Karen