Communication Channels

Get Involved. Join the Conversation.

Topic

    Mustafa Zubaidi
    Syndicated ConditionalChatLink custom_fields
    Topic posted June 7, 2019 by Mustafa ZubaidiRed Ribbon: 250+ Points, tagged Chat 
    58 Views, 2 Comments
    Title:
    Syndicated ConditionalChatLink custom_fields
    Summary:
    How can I use the custom_fields that are passed to chat_launch page
    Content:

    I found a lot of posts about this subject but never found how to use the custom_fields that are passed through the url to the chat_launch page.

    Is it a PHP value that I can pull using $_GET? Or JavaScript?

    Could you please post a code example?

    Thank you!

    Version:
    CP 3.7, OSvC 19A
    Code Snippet:

    Comment

     

    • Ajay Yadav
      i have done it by this code.
       
      <script>
       
              RightNow.Client.Event.evt_widgetLoaded.subscribe(function (eventName, args, scope) {
                  //alert("evt_widgetLoaded");
                  onWidgetLoaded(eventName, args, scope);
              });
       
              function onWidgetLoaded(eventName, args, scope) {
                  //alert("001");
                  var eo = args[0]; //event object
                  //console.log(eo);
       
                  if (eo.name == 'ConditionalChatLink') {
                      //alert("002");
                      var ccl = window[args[0].id];
                      //console.log(ccl);
       
                      var url = ccl.attrs.chat_login_page;
                      //console.log('orig url: ' + url);
       
                      //update URL with new params
                      url += '/Incident.Subject/Test 123/Contact.Name.First/John/Contact.Name.Last/Smith/Incident.CustomFields.c.member_id/T12345/p/1/c/2';
                      //p/1 = Default
                      //c/2 = General Question
       
                      //write new URL back into widget
                      ccl.attrs.chat_login_page = url;
                      //console.log('new url: ' + ccl.attrs.chat_login_page);
                  }
              }
       
          </script>
      • Mustafa Zubaidi

        Could you please share the documentation that you got this code from? I'm getting some errors and would like to figure it out.