Form routing on current users action with different groups

Hello again,
I have multiple groups in sharepoint online site and I want to rout my plumsail form only if current user try to edit items, other wise for new list entry I want to redirect user to the normal form,
I have three forms (screen) default, form1 and form2.
I design new and edit for default form.
And only edit design for form1 and form2.
So when any group user try to enter items in list, he should redirect to default form.
When group1 user come and enter items in list he also redirect to default, but when he try to edit any list item, he should redirect to 'form1'. ( same for group2 user edit item should redirect to 'form2').

I hope you get my point.
Thanks in advance.
Have a good day.

Dear @harshp924,
Well, if I understand you correctly - it's very simple, you just need to select Group1 for Edit Form1 and Group2 for Edit Form2 (you don't need New/Display Form1/2 - this is fine).

Simply specify the Group1 for Form1, and Group2 for Form2:
image

Hello,
I think you won't get my point,
i have two custom groups and i have to redirect only if that two groups user select edit form items,
here i share my code about it,

var web = new Web('siteURL');
return web.currentUser.get()
  .then(function (user) {
    return web.siteUsers.getById(user.Id).groups.get()
      .then(function (groupsData) {
        console.log("groupsData", groupsData);
        var groups = [];
        //check currunt users groups and redirect
        for (var i = 0; i < groupsData.length; i++) {
          if (groupsData[i].Title == 'Institute Users') {
            groups.push('Institute Users');
            
          }

          if (groupsData[i].Title == 'HR Group') {
            groups.push('HR Group');
           
          }
        }
        if(fd.spForm._formType=="New")
        {
          return "URL Link to Default New Form";
        }

        if (groups.indexOf('Institute Users') >= 0) {
          return '742781ac-3c40-4322-80f7-54c2aad3a7d0';
        }
        else if (groups.indexOf('HR Group') >= 0) {
          return '4c3e7800-f3dd-43bc-9816-03cfb6c33b49';
        }


      });
  });

i found error in console that "fd" is not found.
Thanks, Have a good day.

Dear @harshp924,
Yes, fd is only available on the form itself. Here, you can simply use formType instead:
if(formType=="New")

But I'm not sure what kind of link to default form you're planning to return. Here, only form set IDs are read properly when returned, not URLs.

You can try redirecting with
window.location.href = 'URL of default form';
instead.

Thanks @Nikita_Kurguzov
I'm trying to redirect default's "New" form section. If(formType=="New") is true.

Okay, and does it work or is there any issue, do you still need any help?