Custom GAD Tab example

Hi guys,
I’m playing with GAD and deploying the examples, specially I want to open a new tab and show an external URL, however to understand well how this works I began with the example at the development guide.

  1. Created the custom file

<gcn-resources>
<desktop>
	<dictionary-class>custom</dictionary-class>
	<interaction-information>
		<javascript-onload>
		<![CDATA[
			selectTabByName(TAB_INTERACTION_INFORMATION_CUSTOM_ATTACHED_DATA);
		]]>
		</javascript-onload>
	</interaction-information>


	<customer-records>
		<javascript-onload>
		<![CDATA[
			switch(interactionType) {
				case INTERACTION_CHAT:
					selectTabByName(TAB_CUSTOMER_RECORDS_HISTORY);
					break;
				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>

  1. Then created the frame file on same folder:

<%@ page language="java" buffer="none" contentType="text/
html; charset=utf-8" %>
<%
com.genesyslab.ail.AilFactory factory =com.genesyslab.ail.AilLoader.getAilFactory();
com.genesyslab.ail.Interaction interaction =factory.getInteraction( (String)request.getParameter("idInteraction" ) );
com.genesyslab.ail.Contact contact = null;
com.genesyslab.ail.ContactManager contactManager =factory.getContactManager();
if (contactManager != null)
contact = factory.getContactManager().getContact((String)request.getParameter( "idContact" ) ,null);
%>
<html>
<head>
<title>Additional Information</title>
</head>
<body style="font-size: 10pt;" bgcolor="#ffcccc">
<% if( contact != null ) { %>
Contact:
<b>
<%=contact.getTitle()%>
<%=contact.getFirstName()%>
<%=contact.getLastName()%>
</b>

Primary Phone Number:
<b>
<%=contact.getPrimaryPhoneNumber()%>
</b>

Primary E-mail Address:
<b>
<%=contact.getPrimaryEmailAddress()%></b>

<% } else { %>
<center>
<b>
Contact Information Not Available
</b>
</center>

<% } %>
<hr>
<% if( interaction != null ) { %>
Date of Creation:
<b>
<%=interaction.getDateCreated()%>
</b>

Agent:
<b>
<%=interaction.getUserName()%>
</b>

Subject:
<b>
<%=interaction.getSubject()%>
</b>

<% if( interaction.getDn() != null ) { %>
Dn:
<b>
<%=interaction.getDn().getId()%>
</b>

<% } else { %>
Dn:
<b>
No Dn Information Available
</b>

<% } %>
<% } else { %>
<center>
<b>
Interaction Information Not Available
</b>
</center>

<% } %>
</body>
</html>

  1. Then the dictionary file:

AdditionalInformation=Additional Information

But I get this error:


HTTP Status 500 - 

--------------------------------------------------------------------------------

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

org.apache.jasper.JasperException: SvgTag key additionalInformation not found
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
	org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
	org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
	org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	com.genesyslab.uadthin.filter.CachePreventFilter.doFilter(CachePreventFilter.java:30)
	com.genesyslab.uadthin.filter.UTF8Filter.doFilter(UTF8Filter.java:118)


root cause 

javax.servlet.ServletException: SvgTag key additionalInformation not found
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
	org.apache.jsp.interaction.customer_002drecords_002dtab_jsp._jspService(customer_002drecords_002dtab_jsp.java:1012)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
	org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
	org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
	org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	com.genesyslab.uadthin.filter.CachePreventFilter.doFilter(CachePreventFilter.java:30)
	com.genesyslab.uadthin.filter.UTF8Filter.doFilter(UTF8Filter.java:118)


root cause 

javax.servlet.jsp.JspTagException: SvgTag key additionalInformation not found
	com.genesyslab.uadthin.taglib.SvgTag.doStartTag(SvgTag.java:227)
	org.apache.jsp.interaction.customer_002drecords_002dtab_jsp._jspService(customer_002drecords_002dtab_jsp.java:314)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
	org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
	org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
	org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	com.genesyslab.uadthin.filter.CachePreventFilter.doFilter(CachePreventFilter.java:30)
	com.genesyslab.uadthin.filter.UTF8Filter.doFilter(UTF8Filter.java:118)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.25 logs.

And found that has to be with this line at the custom.xml file:

additionalInformation

What can be? I have tried to rename everything without success…
any ideas?

Hi Cavagnaro,

Seems to me you’re “fighting” with GAD a bit ;). But it’s great you didn’t give up!

Your issue relates to fact that you defined a custom “dictionary” (tags dictionary-class and dictionary-key in custom.xml file) but such dictionary doesn’t exists. So you have to do following:

  1. Go to the folder “/webapps/gdesktop/WEB-INF/classes/” and create here new file named “custom.properties”

  2. Insert following line to this file

     additionalInformation=New tab by Cavagnaro!
    
  3. Try to display your tab. Maybe GAD restart will be required.

R.

PS. As usually, haven’t had a chance to test it so use it on your own risk :o

1 Like

Hi René,
Yeah I’m trying to exploit all what this can do and show customers the potential…
I already created that file…seems like it can’t find it…the custom.properties needs some other line? or just that line?

No, just the one line should be sufficient. Each line contains key (defined in XML) and value.

Tip: If you don’t need to use the dictionary remote the tag “dictionary-key” and it should work then. Dictionaries are used mainly for translation purposes.

R.

Just changed the = XXX by the New Tab by cavagnaro and worked… ??? ??? why does this system behaves so crazy? lol
Now, GAD asked me to download the .jsp file…is that normal? As no content on the TAB is shown. And how to show an external URL?
Thanks!

:slight_smile: Solved the jsp problem, a break line at the header which defined the content type was the problem.
Now will play on how to load an external URL :smiley:

:o Worked!


<tab name="Google">
<dictionary-key>Google</dictionary-key>
<scrollbar>true</scrollbar>
<javascript-onselect>
<![CDATA[
document.forms.Google.target = getDetailFrameName();
document.forms.Google.elements.idInteraction.value = idInteraction;
document.forms.Google.elements.idContact.value = idContact;
document.forms.Google.submit();
]]>
</javascript-onselect>
<html-body>
<![CDATA[
<form name="Google" action="http://www.google.com.pe">
<input type="hidden" name="idInteraction">
<input type="hidden" name="idContact">
</form>
]]>
</html-body>
</tab>

Hi cavagnaro,

The error is saying “SvgTag key additionalInformation not found” and it didn’t find it because it’s case-sensitive, so be very carefull.
In your custom.xml


<tab name="additionalInformation">
<dictionary-key>additionalInformation</dictionary-key>

In the dictionary file:


AdditionalInformation=Additional Information

Change the a/A so it matches and your problem is solved. :slight_smile:

A nice example of GAD customisation is to pop-up Google Maps with the address stored in Contact Server…

Enjoy GAD :slight_smile:
Luk

Oh! it was the A! Thanks! Will keep in mind! Yeah saw the video of google! Pretty amazing! Now I’m playing on how to capture attached data :smiley:

1 Like

Hey guys, new question,
Trying to capture userName variable however I can’t do it. My code is:

However I always get a warning message that the variable is not defined, however at the XML Tag Reference guide it says it is availble always. Any idea what am I doing wrong?
Thanks

1 Like

Hi Cavagnaro,

The variable “userName” is defined for particular tags only (desktop, menu, menu-item etc.). In what situation you’d like to use it?

R.

PS. What version of GDesktop you have?

Hi René,
My GAD version is 7.6.01.011.
I want that when my tab Google opens (for example) send as a parameter form the username of the agent. So what I did was:


<customer-records>
		<javascript-onload>
		<![CDATA[
			alert("The agent is : " + userName);
			switch(interactionType) {
				case INTERACTION_CHAT:
					selectTabByName(TAB_CUSTOMER_RECORDS_HISTORY);
					break;
				case INTERACTION_VOICE:
					selectTabByName("eBDWeb");
					break;
				}]]>
		</javascript-onload>


Am I correct? If this shows as alert then will be easy to capture to a variable and then use it to send as hidden parameter of the form.

There is one “issue” - the variable “userName” is available only for child tag “” as stated in the help. So you can’t use it to retrieve agent’s name when opening new tab.

There is a way how to do it but it’s more complicated. You have to write your own jsp page where you’ll retrieve agent’s name using AIL and pass it as parameter to other (your) page.

R.

And what is a CustomEvent? I have read again the XML help file and it says:
“all javascript and DTML tags.” and then below is another variable for customevent which is customEvent.
I also thought the jsp solution, however I have one question there, following and analyzing the examples, the jsp file retrieves a variable and then call a function to get a data from it. Example contact.getTitle(), but in what documentation I can find all those functions like getTitle?
Thanks a lot René

Ok, I saw it, under says that it is usable only on oncustomevent, however on tag it says it is usable on all tags…which one do I use?

1 Like

:smiley: Followed the “hard” idea and it works like a charm! And it gives me more power on how to build the URL, nice! Now to play on how to capture attached data, will follow the examples!
Thanks René!

The documentation that shows you those functions is the “Interaction SDK for Java” documentation. The AIL part.

Luk

1 Like

Thanks! Will begin to read inmediatly!
I already achieved to capture attached data and I did a very nice application which based on the callers options shows different screens of a support web system and I have reduced the time to handle a call a lot! So nice :smiley:
I still complain that it is kinda slow compared to an EXE but has its advantages too.

iS IS POSSIBLE FOR YOU TO SEND THE WORKING COPY OF THE CODE, AS i AM TRYING TO DO SOMETHING SIMILAR BUT HAVING SOME ERRORS, SO IT WILL BE A HELP IF I CAN SEE THE WORKING CODE TO GET AN IDEA. THANKS,

GOLD

Hello,

Did you made any progress with this GAD customization, since I didn’t see any reply on your post?
I am having sort of the same problem:

  • I need a custom jsp to be executed on some event - is it possible?
  • I need this jsp to connect to a Oracle database and query some data - is this possible, as well?
  • last but not least I need to pop-up a new window with a custom URL?

Regards,
Valeriu