Documents & Forms
Microsoft 365 & SharePoint Tools
Classic SharePoint Tools
Apr 03, 2018
Automatic redirection — provide unique forms based on conditions (SharePoint Online Modern UI)
Nikita Kurguzov
Nikita Kurguzov
Customer Support Engineer


In our previous article, we’ve already shown how you can use Plumsail Forms to create unique forms for users of different groups in SharePoint Online Modern UI. This form routing was quite complex and allowed you to select users of which groups to redirect and which groups to exclude.


Now, we want to show you how you can add more complex logic prior to redirection with our Custom routing functionality. You are now able to run JavaScript prior to opening the form and use it to check item’s values, for example, current item’s Status or Author, or current user’s properties, such as title or department.


This allows you to customize redirection down to very specific details as specific as you want it to be. Now, with custom forms, you would be able to personalize each one to fit the situation better. For example, if the Item’s Status is Solved, maybe most fields can be set to read-only state as there is no need to edit them.

//check if Item already exists, true for Edit and Display Form
if (item) {
    // return Promise
    return item.get()
        .then(function (item) {
            //if Item's Status is Solved
            if (item.Status == 'Solved') {
                //redirect to the Form Set with ID:
                return '31fb1f41-63f3-48ff-a1c2-18b4e7f7c3e7'

Another popular scenario is to check if the current user is already present on the form in some field. This way, you can give unique form for this particular user while leaving everyone else on the default form or redirecting them to another Form Set.

//check if Item already exists, true for Edit and Display Form
if (item) {
    //first, get the current user
    var user;
    return web.currentUser.get()
        .then(function(u) {
            user = u;
            return item.get();
        .then(function(item) {
            //if User ID matches ID in the AssignedTo field
            if (user.Id == item.AssignedToId) {
                //redirect to the Form Set with ID:
                return '31fb1f41-63f3-48ff-a1c2-18b4e7f7c3e7';


Custom routing uses SharePoint Patterns & Practices (PnP) JavaScript Core Library, read more about it here. Also check out these two amazing articles: one to get more information on Form Sets and how to use them, second one for better understanding of Plumsail Forms for SharePoint Online Modern UI.

Note: The post has been originally published at Medium:
Have any questions?
Join our community or contact the support team: