Hi everyone,
I'm currently working with Plumsail Forms and facing a strange behavior when using PnPjs inside the fd.spSaved event.
When the NewForm opens in side modal, everything works perfectly. But when it opens in full screen, the PnP-related code inside fd.spSaved fails silently or throws errors (like Failed to fetch).
I'm still new to Plumsail development and not sure if I'm missing something obvious. I'd really appreciate any help.
Here are the two approaches I’ve tried:
First attempt: using default pnp.sp.web
fd.spSaved(async function (result) {
const tempFolderPath = `${window.libraryName}/${window.folderName}`;
const finalFolderPath = `${window.libraryName}/${result.Id}`;
try {
await createFolder(result.Id);
.....
} catch (error) {
alert("Unexpected error during post-save process: " + error.message);
}
});
async function createFolder(itemId) {
try {
await pnp.sp.web.getFolderByServerRelativeUrl(window.libraryName).folders.add(itemId.toString());
} catch (error) {
alert("Failed to create the folder: " + error.message);
}
}
Second attempt: creating a Web instance manually
async function createFolder(itemId) {
try {
let web = new pnp.sp.Web(_spPageContextInfo.webAbsoluteUrl);
await web.getFolderByServerRelativeUrl(window.libraryName).folders.add(itemId.toString());
} catch (error) {
alert("Failed to create the folder: " + error.message);
}
}
In both cases, the folder creation only works when the form is opened in the side panel. When it’s full screen, the PnP methods fail or seem to lose context.
Has anyone faced this before?
Is there something I need to reconfigure or force when in full screen mode?
Thanks in advance