Get ID of the item created and redirect after submit
Hi,
After adding a new item, I'd like to redirect the page to a URL such as: http://abc.com?ID=1234
Where 1234 is the ID of the item that just created.
Is it possible to do this?
After adding a new item, I'd like to redirect the page to a URL such as: http://abc.com?ID=1234
Where 1234 is the ID of the item that just created.
Is it possible to do this?
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Metrovan,
Yes, that is possible, check out this topic - viewtopic.php?f=1&t=1970
Yes, that is possible, check out this topic - viewtopic.php?f=1&t=1970
Cheers
Is there a way to just get the value of the ID?
I am inserting the form on a page, when using:
The ID is always 1.
It only returns the correct ID when I am in the back end to add a new item.
I am inserting the form on a page, when using:
Code: Select all
fd.onsubmit(function() {
var uri = fd.setUrlParam(decodeURIComponent(window.location.href), 'FDRedirectWithID', 'https://domain.sharepoint.com/sites/dev/subsite/SitePages/page.aspx?redirectedID=');
fd.sourceFormParam(uri);
return true;
});
It only returns the correct ID when I am in the back end to add a new item.
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Metrovan,
What do you mean? Try to use:
Add this code to JavaScript editor on the New Form and it should give you the result you are looking for. If it doesn't, please provide screenshots and some details of what goes on instead.
What do you mean? Try to use:
Code: Select all
fd.onsubmit(function() {
var uri = fd.setUrlParam(decodeURIComponent(window.location.href), 'FDRedirectWithID', 'http://abc.com/?ID=');
fd.sourceFormParam(uri);
return true;
});
Cheers
I have that code in my javascript.
I exported and inserted the form onto a page as a webpart.
After the Next submit button, it redirected to the url i want but with ID=1, instead of the real item ID
It only gets the correct ID when I got to the list, and add the item by clicking on + New Item.
When I add the item on a form I exported and inserted on a page, it gets the wrong ID.
I exported and inserted the form onto a page as a webpart.
After the Next submit button, it redirected to the url i want but with ID=1, instead of the real item ID
It only gets the correct ID when I got to the list, and add the item by clicking on + New Item.
When I add the item on a form I exported and inserted on a page, it gets the wrong ID.
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Metrovan,
Where exactly are you putting this JavaScript code? Also, can you tell me how you've published the page?
Where exactly are you putting this JavaScript code? Also, can you tell me how you've published the page?
Cheers
-
- Information
-
Who is online
Users browsing this forum: No registered users and 14 guests