How to set the value of a cookie to a field on an ARSystem form.

Version 2
    Share:|

    This document contains official content from the BMC Software Knowledge Base. It is automatically updated when the knowledge article is modified.


    PRODUCT:

    Remedy AR System Server


    APPLIES TO:

    BMC Remedy AR System Server



    QUESTION:

    How to set the value of a cookie to a field on an ARSystem form.


    ANSWER:

     

    Legacy ID:KA334042

    If you do not already have the cookie created, you can run the following javascript to create one: 

    <script> 
    function SetMyCookie() 

    var cookieName = document.cookieForm.cName.value; 
    var cookieValue = document.cookieForm.cValue.value; 

    document.cookie = cookieName+"="+cookieValue; 

    </script> 

    If you already have the cookie created and want to use the value of it to set an ARSystem field, you can run the following javascript to do so. You will need to manually edit the name of the cookie and the field you want to set the value to. See the comments ("//") within the script. 

    <script> 
    function SetCookieValueToField()  
    {  
    if (document.cookie.length > 0)  
    {  
    // Specify the cookie you wish to get the value of 
    var cookieName = "JSESSIONID";  
    // Specify the database ID of the ARSystem field you want to set. It must include the prepending "F" 
    var arsysfieldID = "F536870918";  
    begin = document.cookie.indexOf(cookieName+"=");  
    if (begin != -1)  
    {  
    begin += cookieName.length+1;  
    end = document.cookie.indexOf(";", begin);  
    if (end == -1) end = document.cookie.length;  
    var cookieVal = document.cookie.substring(begin, end);  
    theForm.getField(arsysfieldID).set(cookieVal);  
    }  
    }  
    }  
    </script> 

    This javascript code can be added to one of the many included javascript files (/apps/shared/javascript) from within the Mid-Tier directory structure or it can be added inside the <HEAD> and </HEAD> tags of the form "Source" tab from within the Administrator tool. 

    You can then invoke the javascript with an active link Run Process, using the following command line syntax: 
    javascript:SetCookieValueToField(); 

    This active link, if running when the page opens, should execute on Window Loaded. 

     


    Article Number:

    000028732


    Article Type:

    FAQ/Procedural



      Looking for additional information?    Search BMC Support  or  Browse Knowledge Articles