Error occurs when redirect to edit form from New Form

Hi There,

I am using form redirection.

 fd.spSaved(function(result) {
 var listId = fd.spFormCtx.ListAttributes.Id;
 var itemId = result.Id;

//replace "https://domain.sharepoint.com/sites/sitename/subsite" with path to your site
//PageType=6 means Edit Form
result.RedirectUrl =
    "https://domain.sharepoint.com/sites/sitename/subsite/_layouts/15/listform.aspx?PageType=6&ListId="
    + listId + "&ID=" + itemId;
});

but i am getting the following error message (Exception from HRESULT: 0x80131904). Please help:

Hey @jyou,

Try replacing "sitename" in the link with the actual name of your SharePoint site (you can check it in your browser's address bar when opening the site).

Let me know if this helps.

hello, my current url is
ttps://itsamcomachinery.sharepoint.com/sites/NCR/Lists/Restore_Non%20Conforming%20Material%20Report_202403121/KUNALS%20VIEW.aspx"

how do I modify the sitename? Thanks

Hey @jyou,

Replace "sitename" with "NCR", that should fix at least some part of the issue.

Let me know how it goes.

i used the following link and still it is giving me the same error. I recently restored my list, is that the reason the link is not working?

//PageType=6 means Edit Form
result.RedirectUrl =
"hhttps://itsamcomachinery.sharepoint.com/sites/NCR/_layouts/15/listform.aspx?PageType=6&ListId="
+ listId + "&ID=" + itemId;

Hey @jyou,

There's an extra 'h' at the beginning of the link, try removing it.

hi i removed it, still giving me an error.