Redirect to a specific formset edit page

Hi,

Having a listitem default plumsail display form, I have defined a button on it. When I click on this button, I want to close the form and redirect to a specific edit form of a specific formset (where I only display the needed fields I want the user to change).

But I do not want that another user that click on modify the listitem, open this edit form. In this case, the default edit form should be opened.

So I cannot base on a hidden field and use custom automatic route based on this field to open the specific. I really want to force the use of a specific form from a specific formset when I do a specific action (here when I click on the button).

How can I do that ?

Added information: even if it is not a good solution for me, I tried to use custom routing.
So I wrote this code (extract):

// on button click, change SelectionPlanification to 'Oui' and save the form
function planifierRealisationOnClick()
{
sp.web.lists.getByTitle('Liste des Livrables').items.getById(fd.itemId).update({
SelectionPlanification: 'Oui'
});
fd.save();
}

// On Saved event, get listId and ItemId and open through dialog the url (I also tried to set Result.RedirectUrl, but as the form is open through Panel, I read that redirect does not work)
fd.spSaved(function(result) {
console.log('spSaved');

var listId = fd.spFormCtx.ListAttributes.Id;
var itemId = result.Id;

Dialog.open("https://<subsiteurl>/_layouts/15/listform.aspx?PageType=6&ListId=" + listId + "&ID=" + itemId,
        { }, null, { width: 600, height: 600  });

});

Above is the custom routing script
if (item) {
return item.get()
.then(function (item) {
if (item.SelectionPlanification == 'Oui') {
return 'cf78783b-f24f-483b-a263-5e7dd219d7f7';
}
});
}

When if click on button, display form closes and the edit form opens...but not the correct one, whereas the SelectionPlanification column contains 'Oui'. It opens the default one...as if routing was not taken into account by this way.

When I try to modify directly the listitem from list, the correct edit form opens...so the routing works in this case.

Regards.

Eric.

Hello @educos35,

You can open specific form set on button click using the code from this post:
Redirect by Group in Custom Routing

Hi,
Would it be possible to pass the formsetid in the url of NewForm, EditForm or DisplayForm and use routing to go to specific formsetid ?
The question comes because, the same specific form could be opened directly from the list using a column containing a button..but the only way to do something behind this button is a url...no script...

Hello @educos35,

Yes, you can pass Form Set ID in query parameter and redirect user to this specific form set using this code in Custom Routing editor:

const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
//FormID is the name of teh query parameter
const formSetId = urlParams.get('FormID')

if(formSetId ){
  return formSetId ;
}

image