Action to update Attachment parent field on new row creation

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I have a popup window that shows fields from a specific row of an object called Grant_Application_Requirement.

Included in that popup windows is an Upload component that uploads a file relating it to the parent Grant_Application_Requirement record being displayed.

This part works well.

Now I would like to update a date field with the date of the last file upload. I attempted to do this by:

1. Create an action on the model Attachment which fires when a new row is added.
2. Action #1: 

3. Action #2: Save Changes in Model: Grant_Application_Requirement.

When I run it nothing happens. Im not sure if the Action is not firing to begin with on the model or if the actions I do have are not properly relating to the right row (it should be based on the parent ID of the record on the Attachment object that was just created)

Thoughts on what I might be missing to make this work properly? 
Photo of Joseph Ucuzoglu

Joseph Ucuzoglu

  • 1,074 Points 1k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
I'm not sure the model recognizes an uploaded file as a new row. I believe an upload automatically triggers a requery of the model that you list in the upload settings so you may want to try triggering the action "on requery"
Photo of Joseph Ucuzoglu

Joseph Ucuzoglu

  • 1,074 Points 1k badge 2x thumb
Thank you the add new row logic was not triggering, your suggestion worked perfectly.
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Joseph,

Your update action doesn't know which row of the Grant_Application_Requirement model to apply the changes to.  I think your best bet is create another model Current_Grant_Application_Requirement and load this model when you click the row action to open the pop up.  Then you can update and save the Current_Grant_Application_Requirement model in your Attachment model action as you show in your screenshot.

Does that make sense?

Thanks,

Bill
Photo of Joseph Ucuzoglu

Joseph Ucuzoglu

  • 1,074 Points 1k badge 2x thumb
Bill thank you, I implemented the solution you recommended and it is working as intended.
Photo of Joseph Ucuzoglu

Joseph Ucuzoglu

  • 1,074 Points 1k badge 2x thumb
Thank you all for the responses. Going to put the suggestions into action and see how it goes.