Customization of GAD, database query with a pop up

I’m doing tests customization of GAD.

When I get a new interaction event I want to open a popup and launch a query on a database (MSSQL) with the ANI of the call.

Following some examples I’ve seen in a Rene post , I managed to launch the popup when I get a call.

Before further testing I would like to know if I want to do is possible.

Sorry for my english.

Hi,

Yes, it’s definitely possible. However, you would need to deploy required ODBC drivers for MSSQL to GDesktop’s Tomcat instance.

R.

2 Likes

Hello again,

I am trying to extract the ANI of a call to generate the query in the database.
I’m using this code:

<%@ page language="java" buffer="none" contentType="text/html; charset=utf-8" %> <%@ page import="java.util.*" %> <%@ page import="javax.sql.*" %> <%@ page import="com.genesyslab.ail.AilLoader" %> <%@ page import="com.genesyslab.ail.AilFactory" %> <%@ page import="com.genesyslab.ail.Interaction" %> <%@ page import="com.genesyslab.ail.Interaction.Type" %> <%@ page import="com.genesyslab.ail.InteractionVoice" %> <%@ page import="com.genesyslab.ail.ws.interaction.voice" %>

the problem is do not return anything. ???

2 Likes

hi,

anyone can help? I do not understand why do not return anything.

Regrads.

Hi,

Please check that interactionId parameter is passed to your JSP page.

getInteraction method returns object of type Interaction so I’m not sure if your statement “if(interaction instanceof InteractionVoice)” is correct.

R.

this is my custom.xml

<gcn-resources>
    <desktop>
     <javascript-onaddinteraction>
      <![CDATA[
                document.forms.welcomeForm.elements.interactionId.value = idInteraction;
                document.forms.welcomeForm.submit();
            ]]>
     </javascript-onaddinteraction>
     <html-body>
            <![CDATA[
                <form name="welcomeForm" target="_blank" method="get"
                      action="custom/welcome.jsp">
                    <input type="hidden" name="interactionId"/>
                </form>
            ]]>
        </html-body>
    </desktop>
</gcn-resources>

i get this http://gce/gdesktop/custom/welcome.jsp?interactionId=Phonecall-5001-006f01f47b204002

I finally made ​​it work.
InteractionID not return the ANI field (do not know why) I picked up the information from the contactID.
I leave the code here in case anyone wants to use.
custom.xml


<gcn-resources>
    <desktop>
        <dictionary-class>custom</dictionary-class>
        <customer-records>
            <javascript-onload>
                <![CDATA[
                    switch(interactionType) {

                        case INTERACTION_VOICE:
                            selectTabByName("AdditionalInformation");
                            break;
                    }
                ]]>
            </javascript-onload>
            <tabs>
                <tab name="AdditionalInformation">
                    <dictionary-key>AdditionalInformation</dictionary-key>
                    <javascript-onselect>
                        <![CDATA[
                            document.forms.additionalInformationForm.target = getDetailFrameName();
                            document.forms.additionalInformationForm.elements.idInteraction.value = idInteraction;
                            document.forms.additionalInformationForm.elements.idContact.value = idContact;
                            document.forms.additionalInformationForm.submit();
                        ]]>
                    </javascript-onselect>
                    <html-body>
                        <![CDATA[
                            <form name="AdditionalInformationForm" action="custom\additionalInformation.jsp">
                                <input type="hidden" name="idInteraction">
                                <input type="hidden" name="idContact">
                            </form>
                        ]]>
                    </html-body>
                </tab>
            </tabs>
        </customer-records>
    </desktop>
</gcn-resources>


additionalinformation.jsp


<%@ page language="java" buffer="none" contentType="text/html; charset=utf-8" %>
<%@ page import="java.util.*" %>
<%@ page import="javax.sql.*" %>
<%
    com.genesyslab.ail.AilFactory factory = com.genesyslab.ail.AilLoader.getAilFactory();
    com.genesyslab.ail.Interaction interaction = factory.getInteraction( (String)request.getParameter( "idInteraction" ) );
    com.genesyslab.ail.ContactManager contactManager = factory.getContactManager();
    com.genesyslab.ail.Contact contact = factory.getContactManager().getContact( (String)request.getParameter( "idContact" ) ,null);
%>

<html>
<head>
<title>Informacion Cliente</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
    <body style="font-size: 13pt;" bgcolor="#ced3de">

</p>
        

<%
java.sql.Connection con;
java.sql.Statement s;
java.sql.ResultSet rs;
java.sql.PreparedStatement pst;


out.println("");
con=null;
s=null;
pst=null;
rs=null;


String url= "jdbc:jtds:sqlserver://localhost/pruebas";
String id= "prueba";
String pass = "Prueb11";
try{

Class.forName("net.sourceforge.jtds.jdbc.Driver");
con = java.sql.DriverManager.getConnection(url, id, pass);

}catch(ClassNotFoundException cnfex){
cnfex.printStackTrace();

}
String sql = "select * from contactos where telefono="+contact.getPrimaryPhoneNumber()+"";
try{
s = con.createStatement();
rs = s.executeQuery(sql);
%>

<%
while( rs.next() ){
%>
<tr>
<td>ID de Cliente: <%= rs.getString("cust_id") %></td>

</br>
<td>Numero de telefono: <%= rs.getString("telefono") %></td>

</br>
<td>Nombre del Cliente: <%= rs.getString("nombre") %></td>
</tr>
<%
}
%>

<%

}
catch(Exception e){e.printStackTrace();}
finally{
if(rs!=null) rs.close();
if(s!=null) s.close();
if(con!=null) con.close();
}

%>

</body>
</html>

1 Like