custom title action button to save and close window

  • 2
  • Question
  • Updated 3 years ago
  • Answered
I have created a simple Skuid page that is launched from a standard button on the Case feed page. The page is supposed to be used as a pop up for editing a subset of case fields and posting a Chatter comment. I would like to create a custom save button on the page that saves all the changes (including the Chatter comment), closes the window, and refreshes the originating case feed page so the data changes will be reflected. Since I am new to Skuid and am not a developer, I am a little lost with regards to the custom button snippets. Where can I find help on how to achieve this?
Photo of Tamar Erlich

Tamar Erlich

  • 110 Points 100 badge 2x thumb

Posted 3 years ago

  • 2
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Tamar,

I think you should be able to accomplish this with the action framework... only a tiny bit of javascript to accomplish the requery.

The standard button on the case feed page should launch a popup. In that popup, use the page include component to pull in your page.

On that custom popup page, use a pagetitle component and add a button to run multiple actions:
  • save model(s) action
  • run custom javascript action
  • close topmost popup action
for your javascript, create a snippet with this single line:

skuid.$M('ParentPageModelName').updateData();
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
As an aside, if you rebuild your custom popup page within the popup on the parent page, instead of using a page include component, you could replace the javascript with a simple Query Model action in the action framework.
Photo of Tamar Erlich

Tamar Erlich

  • 110 Points 100 badge 2x thumb
Hi Matt, thank you for your reply. Currently I am using a field editor component on my page as demonstrated in the tutorials. I will try to read up on the action framework and the page include component and see how I can use them to follow your suggestion.
My originating page is a standard SF case feed page and not a Skuid page. I am launching the Skuid "pop up" page using a URL button. I am not sure what you mean by "rebuild your custom popup within the popup on the parent page". Please excuse my ignorance, this is my very first Skuid page.

.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Tamar,

I'm sorry, I was assuming that the page you were launching from was a skuid page. If you can build your parent page in skuid (instead of just the 'popup' page), you'd have an easier time of it. And by easier, I mean less javascript. But if you want to leave your page as is, you'll have to work around it.

In your current construct, probably the easiest way would be to just have your skuid page save button do the following:
  • save model(s)
  • redirect to url , open in current window. (back to your case feed page)

If you can set up your URL button on the standard SF page to open in the current window instead of a new window, you're all set. Then you don't have to worry about trying to open and close windows and refresh windows with javascript.
Photo of Tamar Erlich

Tamar Erlich

  • 110 Points 100 badge 2x thumb
My requirements are to launch a pop up from the standard case feed page so I'm afraid your suggestion to open in the same window will not work for me. Thank you for your suggestion.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Launching from the standard case feed page means you won't be using a skuid solution to do the launching.  I'm not sure what actions are available on the feed page,  but you might be able to have a custom action or a redirect url that goes to a specific skuid page.  I'm also not sure you can do that in a popup.   The skuid page - easy.  Getting there - not so much. 
Photo of Tamar Erlich

Tamar Erlich

  • 110 Points 100 badge 2x thumb
Hi Rob I can launch the "pop up" from a standard URL button. What I want is have the Skuid "pop up" auto close after I save the data on it. I will try creating a custom save button on my Skuid page that runs multiple actions and see if it works. I think I can get the originating case feed page to refresh if I use a JavaScript button to launch my Skuid "pop up" and reload the window after the Skuid "pop up" closes but I am not a developer and do not know how to write that bit of JavaScript.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
window.close() will close your current window for you in javascript

I'm not sure about refreshing the parent window.
(Edited)
Photo of Spencer Essey

Spencer Essey

  • 70 Points
Thanks Matt, works great as a snippet, very helpful and simple.