3 Replies Latest reply on May 11, 2018 8:09 AM by john_reynolds

    java script in jive page.

    srinivasballe

      Hi All,

       

      I am working on salesforce live agent integration with Jive. so what i want is i would like to add my piece of JAVA SCRIPT code that is given by salesforce in my Jive page, for this i am adding that code in HTML view unfortunately it is clearing my java script tags etc. what should i do , what is the work around for this?.

       

      Appreciate your response.

        • Re: java script in jive page.
          john_reynolds

          Hi Srinivas, a few questions:

           

          • Is your community Cloud, Hosted, or On-Premise?
          • Where are you trying to add the HTML? In the Jive theme?

           

          We've done this before for our clients on Hosted and Cloud, but in a Custom View Tile. It won't display at the page level, but displays like a button on a page.

            • Re: java script in jive page.
              srinivasballe

              Hi John,

              Thanks for responding. ourJive application is hosted internally and  salesforce live agent have piece of code generated by salesforce after you enable live agent, that piece of code contains java scripts and html image tags based on agent availability it will show online/offline images. if the agent is available in online it will show online image and user clicks on that it will open chat window.

               

              Our Requirements:

               

              1. we have internal Jive application.

              2. We have salesforce instance, in that instance we enabled live agent .

               

              This is the piece of code generate by salesforce to add in Jive page, to show salesforce  online/offline image. if user clicks on online image it should open a popup window.

               

              example code :

               

              <img id="liveagent_button_online_5732900000" style="display: none; border: 0px none; cursor: pointer" onclick="liveagent.startChat('573290006')" src="https://srinivasa.salesforce.com/resource/1525709257000/Online" /><img id="liveagent_button_offline_573290000008Of6" style="display: none; border: 0px none; " src="https://srinivasa.salesforce.com/liveaenet/resource/1525709239000/Offline" />

                                      <script type="text/javascript">

                                          if (!window._laq) { window._laq = []; }

                                          window._laq.push(function(){liveagent.showWhenOnline('573290000008Of6', document.getElementById('liveagent_button_online_573290000008Of6'));

                                          liveagent.showWhenOffline('573290000008Of6', document.getElementById('liveagent_button_offline_573290000008Of6'));

                                          });

                                  </script>

               

               

                                  <script type='text/javascript' src='https://c.la4-c1cs-phx.salesforceliveagent.com/content/g/js/42.0/deployment.js'></script>

              <script type='text/javascript'>

                                              liveagent.init('https://d.la4-c1cs-phx.salesforceliveagent.com/chat', '572290000008OZE', '00D290000008tM6');

                                              var orgOpen = window.open;

                                              window.open = function (url, windowName, windowFeatures) {

               

               

                                                  /* Width of the chat window. Use your own value. */

                                                  var chatWindowHeight=510;

                                         

                                                  /* Height of the chat window. Use your own value. */

                                                  var chatWindowWidth=450;

                                         

                                                  /* Calculate the left position to keep the chatwindow in center */

                                                  var left = parseInt((screen.availWidth/2) - (chatWindowWidth/2));

                                         

                                                  /* Calculate the top position to keep the chatwindow in center */

                                                  var top = parseInt((screen.availHeight/2) - (chatWindowHeight/2));

                                         

                                                  /* Create the arguments for window.open method. */

                                                  var windowFeatures = "width=" + chatWindowWidth + ",height=" + chatWindowHeight + ",status,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;

                                         

                                                  return orgOpen(url, windowName, windowFeatures);

                  }  

              </script>

               

               

              Appreciate your response.

                • Re: java script in jive page.
                  john_reynolds

                  Great, that's good information. As I understand it, you run Jive on-premise in your network.  I do need to understand this comment by you

                  for this i am adding that code in HTML view unfortunately it is clearing my java script tags etc.

                  Where is this happening for you? There are many places in Jive to enter HTML/CSS/JavaScript