This is a public Forum  publicRSS

Topic

    Gurpreet Singh
    Passing Parameters from Chat URL to Custom Object
    Topic posted June 19, 2017 by Gurpreet SinghExplorer 
    42 Views, 2 Comments
    Title:
    Passing Parameters from Chat URL to Custom Object
    Content:

    Hello All,

    i have a requirement where i need to pass parameters from Chat URL to create a record in Custom Object. I have tried Using the RightNow.Chat.Controller.ChatCommunicationsController._engagementID from RightNow.Chat.Controller.js , still no success, please let me know if anyone has tried this before? 

    Thanks all

    Answer

     

    • Danette Beal

      Hi Gurpreet,

      I'm going to move this one over to the development forum to get some more technical visibility.

      Regards,

      Danette, Community Manager

    • Gurpreet Singh

      Hello All,

      I Finally Cracked  this Dev is not completed Yet however My initial Testings shown me good Results .

      We need to have know about 2 Widgets and one chat Controller

      1. ChatServerConnect
      2. ChatEngagementStatus
      3. RightNow.Chat.Controller.js

      1st widget will help you to accomodate  and validate the Custom object parameters(you need to write the Custom Validation) that you will pass and from 2nd widget using the Chat controller you can pass the values to Your custom Controller using ajax and then you can very much create a Custom Object.

      Chat states that will be Important on which you wanted to pass information 

      1. CANCELLED:4
        CONNECTED:2
        DEQUEUED:5
        DISCONNECTED:6
        RECONNECTING:7
        REQUEUED:3
        SEARCHING:1
        UNDEFINED:0

      ChatCommunicationsController function From RightNow.Chat.Controller  stores lots of information that you can fetch and pass into your Custom Ajax 

      like _endUser , _agents 

      Sample Ajax Request

      var CurrentState =RightNow.Chat.Controller.ChatCommunicationsController._currentState;

       
       if(CurrentState == 1)
              {
                var ChatID=RightNow.Chat.Controller.ChatCommunicationsController._engagementID;
                 var CustomObject= RightNow.Url.getParameter("CustomObject");
                 var Product = RightNow.Url.getParameter("prod");
                  var Category = RightNow.Url.getParameter("cat");
                  var CurrentChatState = RightNow.Chat.Controller.ChatCommunicationsController._currentState;
       
      var eventObject =  {data: {ChatID, CustomObject,Product,Category,CurrentChatState}};
       
      RightNow.Ajax.makeRequest("/cc/ajaxCustom/ChatParamsParasing",eventObject.data,{
        successHandler: function(response)
        {
      window.console.log(response);
      }, scope: this, data: eventObject, json: true,type:"POST"}          
      ) }
       
      That's all folks this helped me guess help you also.