Redirect after delete

  • 9 February 2017
  • 9 replies
  • 1 view

Badge +1

Hello!

Is there a way to redirect the user to a specific page after deleting a list item?

Doing it after safe or cancel is no problem, but how can this be done after delete?

Any help is much appreciated.

Best Regards,

Dirk


9 replies

Userlevel 6
Badge +13

Hi Dirk,

Can you explain the situation a little more? Are you deleting the item from a button on a Nintex Form?

Badge +1

Hi Ryan,

of course I will try to explain it as best as I can.

I have a leading list called "FMEA" and a related list "FMEA-Items".

In the Nintex form for "FMEA" I have added a list view in order to show related items while the "FMEA" form is in display mode.

The "FMEA-Items" list view contains the standard "Edit-Icon" column.

When I click the edit icon, the corresponding FMEA-Item is being opened in a modal window.

The buttons "Save" and "Cancel" I have modified (Javascript, history.back), so that they are both redirecting to the "FMEA" element that is in the background of the modal window.

After clicking save or canel the modal window disappears and the "FMEA" element reloads automatically. -Perfect-

For deleting an FMEA-Item I also click on the edit icon first and then I click the delete button in the ribbon bar while the "FMEA-Item" is in edit mode.

Unfortunately in this case SharePoint is redirecting to the "FMEA-Items" list instead of reloading the "FMEA"

Hopefully I was able to explain the problem sufficiently.

Best Regards,

Dirk

Badge +6

Hey Dirk Thiele‌,

maybe you could implement a workflow that deletes the current item and add another button to your form which starts the workflow if the user clicks on it. What do you think about it? Here's a good article by Christophe Raucq‌ that explains how to start a workflow with the help of a button:  

Best regards,

Jan

Userlevel 6
Badge +13

For the time being, take the form out of modal mode and it'll help you identify the problem. I think you'll find that the URL contains the query string parameter "Source" and this is most likely causing the redirect. What you might be able to do is build some sort of calculated column that contains the ID of the "parent" item and you can customize your "Source" parameter to redirect you back to your original list item.

If this sounds like it might help you then let me know if you need more any details on how to do this.

Badge +1

Hi Jan,

thank you for the hint.

To be honest, this looks quite difficult. At leastfor me as a beginner in using SharePoint & Nintex.

On top of that, I am under time pressure to get this running.

I was of the opinion there is an easy way to be successful but it seems to be more difficult.

Again, thank you!

Regards,

Dirk

Badge +1

Hi Ryan,

I have already added a column (FMEA_ID) of type integer to my list "FMEA-Item" in which I store the ID of the corresponding FMEA when creating a new item.

I do this by sending the ID of the FMEA via URL-Parameter and picking it with "fn-GetQueryString(FMEA_ID)" inside of the form of the FMEA-Item.

This column is then used as a filter value for the list view inside of the FMEA (Display Form).

The Button in the Ribbon Bar (for creating a new FMEA-Item) I have added via SharePoint Designer with URL-Parameter:

&FMEA_ID={ID}

The form field is hidden.

Then, inside of the FMEA-Item form, I have added the URL of the corresponding FMEA DispView including the FMEA_ID into the standard redirection field that is under settings.

It seems that on delete Nintex is not using the path I have set before.

Maybe because the FMEA-Item is being deleted before the return URL has been created? I don't know...

As I have mentioned, on Save and Cancel the Javascript Buttons with "history.back" are working fine.

Maybe you can show me, how to add a source parameter in a different way so that after deletion of an item SharePoint is redirecting to the "leading" element instead of the list of all related items?

I have no clue...  sad.png

Regards,

Dirk

Userlevel 6
Badge +13

Hi Dirk,

My plan here was that you could create a calculated column in your target list and render this as an Javascript button. So rather than users selecting the standard Item Edit button that SharePoint gives you, you could build your calculated column with a "Source" parameter in the query string or whatever JavaScript you wanted to, to try and achieve your result.

Similar to this

="<input id=""ViewButton""
onclick=""javascript:OpenPopUpPage('theformyouwanttoopen.aspx?ID="&StoreID&"&Source="your redirect url"');""
type=""button""
value=""View Item""/>"

Admittedly I haven't tested this from within a modal dialog, but might be worth trying.

For my solution the buttons render like so

Badge +1

Hi Ryan,

thank you so much for your help.

It is working perfectly, even within a modal dialog.

You made my day!

Thanks and Best Regards,

Dirk

Userlevel 6
Badge +13

Glad it worked. Good to know it does the job in the modal dialog box also. Always handy to be able to open a form within a form.

If you can mark the solution as Correct for future users, that would be great.

Reply