SharePoint - creating a folder using javascript on Nintex classic forms

%3CLINGO-SUB%20id%3D%22lingo-sub-3471662%22%20slang%3D%22en-US%22%3ESharePoint%20-%20creating%20a%20folder%20using%20javascript%20on%20Nintex%20classic%20forms%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3471662%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20script%20im%20working%20on%20that%20is%20currently%20not%20doing%20anything%20but%20is%20supposed%20to%20create%20a%20folder%20in%20a%20document%20library%20based%20on%20a%20field%20in%20Nintex%20classic%20form.%20My%20code%20goes%20like%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Efunction%20folderCreate()%3CBR%20%2F%3E%7B%3CBR%20%2F%3Eappweburl%20%3D%20'%3CA%20href%3D%22https%3A%2F%2Fmytest.sharepoint.com%2Fsites%2FArmieWorkspace%2FFormsApp%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fmytest.sharepoint.com%2Fsites%2FArmieWorkspace%2FFormsApp%3C%2FA%3E'%3B%3CBR%20%2F%3Ehostweburl%20%3D%20'%3CA%20href%3D%22https%3A%2F%2Fmytest.sharepoint.com%2Fsites%2FArmieWorkspace%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fmytest.sharepoint.com%2Fsites%2FArmieWorkspace%3C%2FA%3E'%3B%3CBR%20%2F%3ElistNameTower%20%3D%20%22Attachments%22%3B%3CBR%20%2F%3Evar%20scriptbase%20%3D%20hostweburl%20%2B%20%22%2F_layouts%2F15%2F%22%3B%3CBR%20%2F%3ENWF%24.getScript(scriptbase%20%2B%20%22SP.RequestExecutor.js%22%2C%20execCrossDomainRequestTowers)%3B%3CBR%20%2F%3Efunction%20execCrossDomainRequestTowers()%20%7B%3CBR%20%2F%3Evar%20executor3%20%3D%20new%20SP.RequestExecutor(appweburl)%3B%3CBR%20%2F%3Evar%20uurl%20%3D%20appweburl%20%2B%20%22%2F_api%2FSP.AppContextSite(%40target)%3F%40target%3D'%22%20%2B%20hostweburl%20%2B%20%22%2F_api%2Fcontextinfo%3BSameSite%3DNone%3BSecure'%22%3B%3CBR%20%2F%3Eexecutor3.executeAsync(%3CBR%20%2F%3E%7B%3CBR%20%2F%3Eurl%3A%20uurl%2C%3CBR%20%2F%3Emethod%3A%20%22POST%22%2C%3CBR%20%2F%3Eheaders%3A%20%7B%20%22Accept%22%3A%20%22application%2Fjson%3B%20odata%3Dverbose%22%20%7D%2C%3CBR%20%2F%3Esuccess%3A%20successHandlerFolder%2C%3CBR%20%2F%3Eerror%3A%20errorHandlerFolder%3CBR%20%2F%3E%7D%3CBR%20%2F%3E)%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ecan%20you%20please%20help%20me%2Fadvise%20what%20is%20missing%20on%20this%20script%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3471662%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDocument%20Library%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ENintex%20Classic%20Form%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Visitor

I have a script im working on that is currently not doing anything but is supposed to create a folder in a document library based on a field in Nintex classic form. My code goes like this:

 

function folderCreate()
{
appweburl = 'https://mytest.sharepoint.com/sites/ArmieWorkspace/FormsApp';
hostweburl = 'https://mytest.sharepoint.com/sites/ArmieWorkspace';
listNameTower = "Attachments";
var scriptbase = hostweburl + "/_layouts/15/";
NWF$.getScript(scriptbase + "SP.RequestExecutor.js", execCrossDomainRequestTowers);
function execCrossDomainRequestTowers() {
var executor3 = new SP.RequestExecutor(appweburl);
var uurl = appweburl + "/_api/SP.AppContextSite(@target)?@target='" + hostweburl + "/_api/contextinfo;SameSite=None;Secure'";
executor3.executeAsync(
{
url: uurl,
method: "POST",
headers: { "Accept": "application/json; odata=verbose" },
success: successHandlerFolder,
error: errorHandlerFolder
}
);

 

can you please help me/advise what is missing on this script?

0 Replies