Duplicate Rows Added to Table

I have a table in which the user can add the names of attachments from another object.  These attachment names are added to a separate object that which contains the ID of the parent record as a relationship key.

In the example above, the user has added “Sample Attachment #10” to the current record.  The user can add an undefined number of attachments to each record.  I have this setup so that the attachments model opens a popup when a new record is attached to the parent record.  

In the popup shown above, the user clicks on the paper clip icon which triggers a multiple action event.  The table listed above is connected to a model in which all of the original attachments are initially added to the database.

Just so I’m clear, model_attachments is the model in which the files are added to the database, model_parent contains the records to which the attachments will be linked, and model_attach_list is the model connected to each record in model_parent that allows the user to add an undefined number of attachments.  Clear as mud?

My problem is this:  When the user clicks the icon to “link” an attachment to a record, ALL of the attachments in the model_attachments are changed to to the current attachment.

You can see above that “Attachment #10” now shows as “Attachment #14” when the user tried to add “Attachment #14” to the table.

When the icon is clicked, the actions are:
1. Update a field on a Row  >>>  model_attach_list   >>>  Attachment Name  >>>  {{AttachTitle__c}}
2. Update a field on a Row  >>>  model_attach_list   >>>  Attachment ID  >>>  {{AttachID__c}}

In these 2 actions, {{AttachTitle__c}} and {{AttachID__c}} are fields in the popup table from model_attachments.


Scott you’ve got me spinning there. 

It looks though like you are on a row of model 1 and are asking to update row(s) of model 2 when you click the icon.  In this case Skuid doesn’t know which row to update and so it updates them all.   So Skuid is working here as it was designed. 

I think the answer to your challenge will be found in the data model.  You can use the action framework to add a row to identifiy the new attachment,  and add a default value to connect that new row with a parent, etc.  But it has to be done within a correct data model. 

I may also be completely blind to your genius here.  That is totally possible. 

I’m still working on this issue and it’s starting to make my hair fall out… let me ask this, why does the Action Type read “Update a Field on Row(s)”?  Is it possible that i’m inadvertently updating mulitple rows? 

Anyone have any thoughts on this?

Hi Scott,

Maybe I’m not understanding this correctly, but when you click on the paper clip, wouldn’t you want to create a new row in your “Attachment Links” table, not update existing rows?  That would be a different action type in the action framework.

I’ll try this.  But let me now ask:  how do I capture field data from a table row when I click the paperclip?

You should just be able to use merge syntax (e.g. {{Name}} or {{Description}}). Since it’s a row action, Skuid should use the field value from the row in context. Does that answer your question?

right you are - thanks Emily!