Canvas Initiate

Setting/Retrieving a cookie value from a Nintex O365 Classic Form

I have a SharePoint app that was recently migrated to SPO from On-Prem. This app has a page that contains a connecting webpart that allows users to select an item, and click a button that opens a Nintex form in a modal window. Clicking the button creates a cookie from the selected item that is being used to autopopulate a field in the Nintex form within the modal window.  This is working great in On-Prem but in Nintex O365, I’m using the classic design, and because Nintex O365 is an app, forms are displayed in an iFrame and I can’t pass a cookie from a Sharepoint aspx page to the iframe within a modal window.


I can display the cookie value when it is being created. But because Nintex O365 is now an app, the forms open in an iframe which is in a different domain and the value is not there.


The JavaScript I’m using is working fine in on-prem. Here is a snippet of code for the webpart on the home page:


<input class="pbutton" onclick="clickbutton('', 'New Output')"

id="btn4" type="button"

value="Add Output"

style="white-space: normal;min-height:45px; width:125px" />


function clickbutton(url,title){

    var itemID = selVal();


    //alert('cookie =' + document.cookie);


    url: url,

    title: title,

    dialogReturnValueCallback: function(dialogResult) {


         SP.UI.ModalDialog.commonModalDialogClose(1, 1);




    return true;


function createCookie(name, value) {

    var date = new Date();

    //make the cookie expire in 5 minutes


    var expires = "; expires="+date.toGMTString();

    document.cookie = name+"="+value+expires+"; path=/";

    //document.cookie = name+"="+value+expires+"; path=/" + ";;secure";




Here is the javascript I have inserted into the Nintex form:


NWF$(document).ready(function (){

 //Customize the following cookie name for use on different forms

 var cookieName = "ProjectID";

 var projectID = getCookie(cookieName);

 var txtTitle = document.getElementById(Project);

 txtTitle.innerText = projectID;


 if (projectID != undefined){

     //Set the value in our new form


     //Clean up the cookie by setting the expiration to a time before now




function getCookie(name) {

        var cookieArray = document.cookie.split(";");

        //alert('cookieArray = ' + cookieArray)

        for (index in cookieArray)


            var keyValuePair = cookieArray[index].split("=");

            var key = keyValuePair[0];

            key  = key.replace(/^\s+|\s+$/g, "");

            if (key == name)


                var value = keyValuePair[1];

    return value;   





    function destroyCookie(name) {

       //make the cookie expired so it is deleted

    document.cookie = name+'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';



So when the Nintex form opens in the modal window, the Project field is not pre-populated with the cookie value because the cookie can not be found.  Has anyone had any issues with Nintex O365 using the classic design and dealing with iframes and any insights on how I can pass a cookie value to an iFrame?



0 Kudos