Margo
(Margo)
April 7, 2020, 1:48pm
2
Hello @Vasilii_Burca ,
The RedirectUrl field is available only under the spSaved event. Please find more information here .
If you need a button that saves items and redirects a user to the specific URL that includes item ID, please use the following code in the button's onClick settings.
fd.spSaved(function(result) {
var itemId = result.Id;
result.RedirectUrl =
"Your URL" + itemId;
});
return fd.save();
Also, you might be interested in the Redirect user after form submission in SharePoint article.
1 Like
Thank you that helped a lot and very handy by the way that it automaticly replaces ID.
After further testing, it seems like it does not change the ID portion.
I marked the portion of URL I need to change with the current Item ID
Here is my code:
fd.spSaved(function(result) {
var itemId = result.Id;
result.RedirectUrl =
"http://intranet.maib.local/sites/help/Workflows/preluareElement/preluareElement.aspx?List={7a9edd38-3f18-4bef-99f6-062067196fa2}&***ID=72***&ItemGuid={BE628B7D-57E1-44C0-8377-A389786A17E7}&TemplateID={ed452887-7ecf-4a7b-9d9f-de7b1b8eb19e}&Source=http%3A%2F%2Fintranet%2Emaib%2Elocal%2Fsites%2Fhelp%2FLists%2FCerere%2520de%2520suport%2FAllItems%2Easpx%3Fweb%3D1" + itemId;
});
return fd.save();
And one more question can i just close the form without saving an redirect fd.close() or something like in Infopath ?
Thank you!
Margo
(Margo)
April 8, 2020, 8:13pm
5
Hello @Vasilii_Burca ,
You need to combine the string with item ID variable, please see the updated code.
fd.spSaved(function(result) {
var itemId = result.Id;
result.RedirectUrl =
"http://intranet.maib.local/sites/help/Workflows/preluareElement/preluareElement.aspx?List={7a9edd38-3f18-4bef-99f6-062067196fa2}&ID=" + itemId + "72&ItemGuid={BE628B7D-57E1-44C0-8377-A389786A17E7}&TemplateID={ed452887-7ecf-4a7b-9d9f-de7b1b8eb19e}&Source=http%3A%2F%2Fintranet%2Emaib%2Elocal%2Fsites%2Fhelp%2FLists%2FCerere%2520de%2520suport%2FAllItems%2Easpx%3Fweb%3D1";
});
return fd.save();
And to redirect to specific page when the form is closed, you can use this code:
fd.spClosed(function(result) {
fd.source="URL";
})
1 Like
@Margo - Hello there. quick question. Newbie here. How can i make the button redirect to a URL when pressed?
Margo
(Margo)
April 8, 2022, 6:11am
8
Hello @EchodaPogi ,
Simply add this code to the button's click property:
window.location.href = 'https://plumsail.com'
Thank you @Margo . It worked perfectly
1 Like