Route to default form


I used a direct URL to specific form sets to open forms from buttons or in dialogs.
Now that routing is done differently, I'm changing to use a query parameter.

But how do I route to the default form? Which does not have a form set ID?
For example, in the code below, my discipline is Systems Engineer, so I route to the "master form".
In that form are buttons which direct to any of the forms, including the default.

e.g. On button click (this one works fine):"", "_self");

But this button to the default form puts me into a loop (It routes me back to the master form, when I want the default...):"", "_self");

Here is the routing:

const queryString =;
const urlParams = new URLSearchParams(queryString);
//FormID is the name of the query parameter
const formSetId = urlParams.get('FormID')
if(formSetId ){
  //open the form based on query parameter
  return formSetId ;
else {
//Get properties of the current user
return pnp.sp.profiles.myProperties.get().then(function(result) {
    var props = result.UserProfileProperties;
    //if there is a property with Key: Department and Value: Engineering
    if (props.some(function(p){ return p.Key === 'Discipline' && (p.Value === 'Administrator' || p.Value === 'Town Planner' || p.Value === 'Landscape Architect' || p.Value === 'Urban Designer' || p.Value === 'Accountant' || p.Value === 'Human Resources' || p.Value === 'Traffic Engineer' || p.Value === 'Desktop Support' || p.Value === 'Systems Administrator' || p.Value === 'End User Support')})) {
        //return ID of Lite Form Set
        return 'a58f6909-b230-486a-8134-ac9e5bbef75d';
        else if (props.some(function(p){ return p.Key === 'Discipline' && (p.Value === 'Engineer' || p.Value === 'Construction Engineer' || p.Value === 'Project Manager' || p.Value === 'Water Resources Engineer')})) {
        //return ID of Engineering's Form Set
        return '3282d960-7982-464d-96cd-4d67201fafb0'
        else if (props.some(function(p){ return p.Key === 'Discipline' && (p.Value === 'Executive' || p.Value === 'Systems Engineer' || p.Value === 'Auditor')})) {
            //return ID of Master Form Set
        return 'e792d63a-0a22-4266-a0e4-c07892791616'

Your assistance would be greatly appreciated!


Dear @Adam,
You just need to ensure no form set ID is returned, then the users will be redirected to the default form. Perhaps some extra check conditions might help? For example, you can wrap all the current return statements inside of an if statement, where you'll check the opposite of what you want, so only to whose who don't need to be redirected to default form are redirected at all.

Finally, if this doesn't work, you could always duplicate the default form to some new Form Set and redirect users to this new Form Set instead.