Getting started
User guide
- Settings
- Form sets
- Containers
- Controls
- SharePoint fields
- Common fields
- JavaScript
- CSS
- SharePoint form panel
- SharePoint web parts
- Microsoft Teams tab
- Forms versioning
Provisioning forms
Examples
- Ticket management system
- Dynamic form for a user group
- Conference room reservation system
- Discussion within a SharePoint form
- Version history within a SharePoint form
- Organize related docs in libraries and folders
- Duplicate item button for List or Library
- Move new form page to another location
General
- YouTube
- Licensing
- Manage subscription
- Billing and payments
- Privacy policy
- Data protection and security
- Version history (Microsoft 365)
- Version history (SharePoint 2019/SE)
Multilingual support
Navigation between forms
- Generate a link to a SharePoint form
- Redirect user after form submission
- Open edit form by default for a user group
- Open form in a dialog
Generating PDF documents
- Save SharePoint form as PDF
- Generate PDF from DOCX template with Plumsail Processes
- Generate PDF from DOCX template with Word Online (Business)
Integration with Power Automate
How to redirect users to another form or specific URL after submitting a SharePoint form
Say you have a SharePoint form that adds items to the SharePoint list on its submission. You don’t want people submitting this SharePoint form to view this items list. You need to set redirects to another page on submitting the SharePoint form. It can be a home page URL, or Thank you page, or even another form - just a few examples out of many.
With Plumsail Forms for SharePoint, you can easily lead your users through SharePoint. In this article, you’ll find ready code samples for using the spSaved() event that is good for redirects on submit. Read more about different events in our Events section.
Note
The examples below are not applicable when the form is opened in a panel. RedirectUrl is ignored inside a panel.
Redirect to any page
To redirect users to any page on the web, all you need to know is the URL of this page. It can be a page on your SharePoint site or it can be any website page.
Just add this code to JavaScript editor and it will automatically redirect users to the specified page:
fd.spSaved(result => {
// simply replace this url with yours:
result.RedirectUrl =
'https://domain.sharepoint.com/sites/sitename/SitePages/ThankYou.aspx';
});
Redirect to New Form
Do you want your users to be able to start working on a new item straight after they save an item? That’s possible by redirecting them to the New Form of the same list as soon as the form is saved.
This code redirects users to the New Form and can work from both New Form and Edit Form:
fd.spSaved(result => {
const listId = fd.spFormCtx.ListAttributes.Id;
// replace "https://domain.sharepoint.com/sites/sitename/subsite" with path to your site
// PageType=8 means new form, no itemId is required
result.RedirectUrl =
'https://domain.sharepoint.com/sites/sitename/subsite/_layouts/15/listform.aspx?PageType=8&ListId='
+ listId;
});
Redirect to Edit Form
Sometimes, it’s important to redirect users to Edit Form. For example, you want users to save an item and still be able to continue editing it. The best option in this case would be redirect users seamlessly from the New Form to the Edit Form, once they click the save button.
This code will do just that:
fd.spSaved(result => {
const listId = fd.spFormCtx.ListAttributes.Id;
const 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;
});
Prevent redirection on save
For Edit Form, it is possible to use code which will prevent redirection on save, so you can save the form and continue working.
Please, do not use for New Form! Redirect to Edit Form instead!
fd.spSaved(result => {
result.RedirectUrl = null;
});
Redirect to Display Form
Finally, you can also redirect users to the Display Form, from both the New Form and the Edit Form.
Here’s how it can be done:
fd.spSaved(result => {
const listId = fd.spFormCtx.ListAttributes.Id;
const itemId = result.Id;
// replace "https://domain.sharepoint.com/sites/sitename/subsite" with path to your site
// PageType=4 means display form
result.RedirectUrl =
'https://domain.sharepoint.com/sites/sitename/subsite/_layouts/15/listform.aspx?PageType=4&ListId='
+ listId + '&ID=' + itemId;
});
Use form values for redirecting
You can’t directly address field values in fd.spSaved(). The only exception is addressing a SharePoint field of an Edit form.
Let’s say you have a common Choice field on the form with the New, Edit, and Display options. To redirect the user to the form chosen in the field, save its value to a variable before the form is submitted:
let redirectValue;
fd.spBeforeSave(() => {
redirectValue = fd.field('Redirect').value;
});
fd.spSaved(result => {
let url = '';
const listId = fd.spFormCtx.ListAttributes.Id;
const itemId = result.Id;
switch (redirectValue) {
case 'New':
url = 'https://domain.sharepoint.com/sites/sitename/subsite/_layouts/15/listform.aspx?PageType=8&ListId=' + listId;
break;
case 'Edit':
url = 'https://domain.sharepoint.com/sites/sitename/subsite/_layouts/15/listform.aspx?PageType=6&ListId=' + listId + '&ID=' + itemId;
break;
case 'Display':
default:
url = 'https://domain.sharepoint.com/sites/sitename/subsite/_layouts/15/listform.aspx?PageType=4&ListId=' + listId + '&ID=' + itemId;
break;
}
result.RedirectUrl = url;
});