Redirect from Display Form immediately

Hello community,
Need help with redirection after clicking on the list item to Display a Form. I need the people to be immediately redirected to Edit Form.

Here is the code - when I log the URL to the console, it works, but when I open the list item in Display Form, it won't do anything. It does not redirect me.

fd.spRendered(function(result) {

var listId = fd.spFormCtx.ListAttributes.Id;
var itemId = result.itemId;
//replace "" with path to your site
//PageType=6 means Edit Form
result.RedirectUrl =
+ listId + "&ID=" + itemId;

Thank you for your help.

Dear @Stepan,
Something like should be enough for simple redirect, you don't need anything else:

var itemId = fd.itemId; 
var listID = fd.spFormCtx.ListAttributes.Id;
window.location.href = '' + listID + "&ID=" + itemId;
1 Like

It works :slight_smile: Thank you.