Redirect to a URL on closing Form

Hi,

I'm opening a form from a specific library view. When I close the Form I'm redirected to the All Items view of a document library. This causes an error because this view hits the 5000 items limit.

On save I use this js code to redirect to a specific page:

fd.spSaved(function(result) {
result.RedirectUrl =
"/sites/digitalworkinstructions/SitePages/WorkDocMenu.aspx";
});

The same code for close doesn't work:

fd.spClosed(function(result) {
result.RedirectUrl =
"/sites/digitalworkinstructions/SitePages/WorkDocMenu.aspx";
});

Which code can I use for close and is there a way to redirect to the view from which I opened the form?

(The code in this Topic also doesn't work: Redirect form on Close )

Dear @Pieter,
Please, try the following:

fd.spClosed(function() {
  fd.source = "https://plumsail.com";
});

Hi Nikita,

That works. Thanks...

But, is there a way to get redirected to the library view that was displayed when I openend the Form?
I have a lot of different views (because of the 5000 item limit in a view) like this one: "/sites/digitalworkinstructions/docwrk/Forms/2111Production.aspx"
When I open a record from this view and close or save it I would like to be redirected back to this view.