How we get the sourceURL in a form (to go to correct list-view back)

We open different forms basend on button links in SPO list views (generated by SPO colum formatting in modern list view). But for going back, we need the sourceUrl of the formerly list-view to show the same list-view after editing some list item.

document.referrer or instead js objects doesn't show the formerly url.

Hello @mozilla0,

You have two options to set the Source URL.

  1. Specify the Source URL in the button link in the list view.
    So the link to the item will be:

  2. You can add the following code to the form in JavaScript Editor. But in this case, a user always will be redirected to the specified URL.

fd.spBeforeSave(function(spForm) {

  fd.source = '<List view URL>';


Hi mozilla0.

I like the look of your column formatting in modern sharepoint lists. Would you mind sharing the JSON for each of the formatted columns shown in your screencapture?


Hi @mnikitina, that doesn't solve my use case. I want get back to the original url which has the form loaded (like document.referrer / window.history.go(-1)), but I doesnt have a chance to get this value in the form to redierct back after save. Beacuse the form always go back to the standard view on the list.

There is no chance to retrieve the referrer url in Plumsail forms?

Hi @stormanh. Here are the files which we use for formatting the list:

DueDate.json (309 Bytes)
DMAIC.json (663 Bytes)
OnTrade.json (453 Bytes)
Button2.json (887 Bytes)
Button.json (581 Bytes)


Please use the below code to be redirected o the previous page.

fd.spBeforeSave(function(spForm) {

  fd.source = window.history.back();


Thank you very much!

1 Like