Root Folder auto populate in Nintex Form

Discussion created by santhoshraj on Apr 17, 2018

We have a share point list which has "US" as the Root Folder and "Texas" and "New York" as Sub Folders within the Root Folder "US". We activated Nintex forms for this list. Whether we are under the Root Folder "US" or under the Sub Folders "Texas"/"New York", we want the Root Folder "US" to be auto populated on the new item form. 


We used the below code, which auto populates the Sub Folders on the new item form, but we need the Root Folder. 


$(document).ready(function() {
//Get the value of the RootFolder from the URL
var foldername=GetUrlKeyValue('RootFolder', true);//Split the URL at List name
var folder1=foldername.split("TestList").pop();//If folders are present in the list
if (folder1.length >0)
{//Get the first folder name from the URL
var folder1=folder1.split("%2F").pop();//Replace special chartacres
folder1=folder1.replace(/%20/g," ");
folder1=folder1.replace(/%2D/g,"-"); NWF$('#' + varCountry).val(folder1);}
{alert ("Please select a Component");