Refresh Parent Record After Related Tables are Updated

  • 1
  • Question
  • Updated 4 years ago
  • Answered
I am trying to figure out how to get my Opportunity page to Refresh after the filtered Records in a related table are updated to no longer meet the filter condition.

Basically We have an Opportunity page with Related "Intake Queues." Intake Queue is a lookup child to Opportunity and they are often incomplete after creation. Before we can move an Opportunity forward in our process these child records need to be complete.

For user experience we have filtered tables showing the incomplete records. Users can Mass Edit these inline and then save. Right now only the updated records save to reflect the changes but we want them to disappear off the table. To do so the entire opportunity page needs to be refreshed.

Nothing is changing on the Opportunity record itself and I have been unable to adapt the sample code I have found here that updates the page if a something like a roll up summary is updated on the parent. I need help!
Photo of Jessica Shier

Jessica Shier

  • 208 Points 100 badge 2x thumb

Posted 5 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Here's what you need to do:

(1) Go to your page's Resources tab, and click to add a new JavaScript Resource.



(2) Click on the new JS Resource to edit it. The Resource Type should be "Inline", and you can name it whatever you want. Click the "Open Resource Editor" button to edit the Resource Body.





(3) Here is what the body of the Resource should be. Everything should stay the same here EXCEPT for the "MODEL_NAME" variable --- replace this with the name of your Intake Queues Model:



Here is the code for you to copy. Just replace "IntakeQueues" with whatever the actual name of your Intake Queues Model is:



(function(skuid){

// The name of the Model you want to update after saving
var MODEL_NAME = 'IntakeQueues';

var $ = skuid.$;
$(function(){

var model = skuid.model.getModel(MODEL_NAME),
listener = new skuid.ui.Editor(null);
listener.registerModel(model);
listener.handleSave = function(totalsuccess){
if (totalsuccess){
model.updateData();
}
};

});

})(skuid);


Photo of Jessica Shier

Jessica Shier

  • 208 Points 100 badge 2x thumb
Thank you so much! That Worked!
Photo of Jonathan Adlerstein

Jonathan Adlerstein

  • 528 Points 500 badge 2x thumb
That's really useful, thank you!
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Note:  This sort of parent update is now possible with a Model Action.  No code needed.  Create a model action on the child object.  Whenever it is saved have the parent model get queried.  That will re-execute all roll up summary fields and formula based status fields.