Can't open panel from toolbar button

It seems that I cannot open the form from button click even and have this error -

The code looks like this:
fd.toolbar.buttons[1].click = function(){

var listId = fd.spFormCtx.ListAttributes.Id;
var itemId = fd.itemId;
fd.close();
if (fd.isPanel) {
    const formCommands = new window.Plumsail.FormCommands({
        webUrl: fd._formManager._webUrl,
        listId: listId,
        listUrl: fd._formManager._listUrl,
        culture: _spPageContextInfo.currentUICultureName,
        language: _spPageContextInfo.currentLanguage,
        componentLoader: window._spComponentLoader
    });
    formCommands.load().then(function() {
        formCommands._openPanel({
            itemId: itemId,
            contentTypeId: fd.contentTypeId,
            formType: "Edit",
            rootFolder: fd.rootFolder
        });
    });
    } else {
        window.location.href =
            "" 
            + listId + "&ID=" + itemId;
        }
}

It seems that formCommands.load() is not loading for me, is there a workaround so that I could make "Save" button into "Edit" button but with a possibility of keeping panel open?

Hello @Unknown,

f you want to redirect users to Edit Form and keep the panel opened, you can do that using this code:

fd.spSaved(function(result) {
    var listId = fd.spFormCtx.ListAttributes.Id;
    var itemId = result.Id;
    if (fd.isPanel) {
        const formCommands = new window.Plumsail.FormCommands({
            webUrl: fd._formManager._webUrl,
            listId: listId,
            listUrl: fd._formManager._listUrl,
            culture: _spPageContextInfo.currentUICultureName,
            language: _spPageContextInfo.currentLanguage,
            componentLoader: window._spComponentLoader
        });
        formCommands.load().then(function() {
            formCommands._openPanel({
                itemId: itemId,
                contentTypeId: fd.contentTypeId,
                formType: "Edit",
                rootFolder: fd.rootFolder
            });
        });
        //close original panel
        fd.close();
        }
});

Hiya @Margo

This code doesn't work anymore, since Microsoft forced a change to the list interface, opening panels using your code no longer works.

Do you know the amended code for the new Lists interface?

Regards

Hello @Jamal_Smith-Graham, @Unknown,

We've published an update, the code should work now. Please clear the browser cache and test.

2 Likes

Hiya Margo

Sorry for the delayed reply, been on annual leave, you are correct, this has been fixed!

Thanking you much! :slight_smile:

2 Likes