function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sravana SudheerSravana Sudheer 

Modal pop up in Home page Component

Hi
We are trying to create a modal pop up in home page component. For this we are using Jquery Libraries. And the way which we want the pop up to work is , We have a custom object called Home Modal and 2 custom fields for it namely modal status and User which is look up to user. So the functionality is when ever user logins for the first time it is suppose to show the modal pop, And if the user clicks i've read and understand  this button which is in the bottom of modal it is suppose to create a record in the custom object with the name of user pops up in the user fields and setting the modal status field to true(text field). So that if user clicks on it for first time until and unless the record deletes it wont pop up again. it is working in the way which we are looking for in Visual fprce pages but when tried pasting the same code in Home page component it is not working. I think component is not supporting to get the session id. The Code i am using is


<html>
  <head>
  <title>jQuery UI Dialog - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css"/>
  
<script src="https://ags360--pdev.cs15.my.salesforce.com/soap/ajax/33.0/connection.js"  type="text/javascript"></script>

  <script type="text/javascript">
      sforce.connection.sessionId = "{!$Api.Session_ID}";

    var __sfdcSessionId = document.cookie.match('sid=([^;]*)')[1];
  </script>
  
    <script type="text/javascript">
    alert("Scripttt");
    var soql;
    var result;
    var records;
    var UserInfo;
      
    function showModal(){
                
        UserInfo = sforce.connection.getUserInfo();
        alert(UserInfo.userId);
        soql = "SELECT modal_status__c, User__r.Name FROM Home_modal__c  Where User__c='"+UserInfo.userId+"' ";
        result = sforce.connection.query(soql);
        records = result.getArray("records");
                    alert("records len=="+records.length);
        if(records.length==0){
            $(function() {
                    $( "#dialog" ).dialog({
                    modal: true,
                    draggable: false,
                    resizable: false,
                    position: ['center', 'top'],
                    show: 'blind',
                    hide: 'blind',
                    width: 400,
                    dialogClass: 'ui-dialog-osx',
                    buttons: {
                        "I've read and understand this": function() {
                            insertModalStatus();
                            $(this).dialog("close");
                            
                        }
                    }
                    });
                  });
        }
        
 
    }
    
    
                  
  function insertModalStatus(){
     //alert("asdasdasdasdas");
    var modalObj = new sforce.SObject("Home_modal__c");
    modalObj.User__c=UserInfo.userId;
    modalObj.modal_status__c="true";
    var insertResult = sforce.connection.create([modalObj]);   
    alert("insertResult == "+insertResult )
}

showModal();
  </script>

  <style>
  .ui-draggable .ui-dialog-titlebar {
  cursor: move;
  background: #A6192E;color: white;
}
  .ui-dialog .ui-dialog-titlebar {
  padding: .4em 1em;
  position: relative;
  background: #A6192E;color: white;
}
.ui-dialog .ui-dialog-buttonpane button {
  margin: .5em .4em .5em 0;
  cursor: pointer;
  background: #A6192E;color: white;
}
  </style>
</head>
 
<body>
 
<div id="dialog"  style='display:none;' title="Important Changes to Program Records ">
  <p>The AGS 360 team will be implementing a simplified structure for using Programs over the course of February. This will result in a more straightforward experience when referencing programs on projects, cases and other sections of the system while improving reporting capabilities. Look for more updates and system changes in the coming weeks.

Additionally, we'd like to extend a hearty welcome to the Operations pilot group. The program teams from Wellpoint, NAIC, Lexmark and Progressive have begun using AGS 360 for an expanded range of business processes. This pilot will exercise a wide variety of functionality in the system and set the stage for successful alignment to the AGS Way. We look forward to the feedback and insights from the pilot team.

For support, email <a href="mailto:AGS360@allegisglobalsolutions.com">AGS360</a></p>
</div>
 
 
</body>
</html>

Any suggestion will be great help.

 
ShashankShashank (Salesforce Developers) 
Please see information about changes related to html on home page components: http://docs.releasenotes.salesforce.com/en-us/summer14/release-notes/rn_forcecom_home_page_components.htm

More changes with Summer '15: https://help.salesforce.com/apex/HTViewSolution?urlname=Home-Page-Components-Changes-Starting-Summer-14&