Siebel CTI integration using Chrome extension and injected javascript script
4. 10. 2019
We would like to share wit you the knowledge how can be Oracle Siebel CRM integrated with 3rd party solutions on client side. In this blog we will focus on CTI integration, what is typically the most frequent use case for integration. Of course, our approach can be use for any type of client-side integration for Siebel Open UI clients.
In the past, contact center providers had to develop special drivers to allow their functionality in Siebel CRM clients. With introducing HTML5 and Siebel OpenUI Framework as well as Extensions capabilities of internet browsers (Chrome, Firefox, Edge) other possibilities has come into the account.
We have already published blog for this topic on our website, please see: http://www.ccw.sk/sk/blog/siebel-client-side-integration-using-chrome-extension.html
The used approach uses Siebel SWE integration (SWE commands in URL) to execute some Siebel functionality by calling it from another application. The typical use case is navigation to customer screen, or create or update call activity etc. URL link can look as follows:
https://siebel.customer.com/siebel/app/cc/enu?SWECmd=InvokeMethod&SWEMethod=AgentNotifyInboundEvent&SWEService=CTI+URL+Call+Handler&
Operation=CallRinging&Activity+Id=1-A4RE1&OriginTelNumber=0584042818&Call+Id=f79c929d-97aa&SWERF=1&SWEBU=1
Our Chrome extension ensures that URL call is always redirected to the existing open Siebel window. It is working fine but have some drawbacks which we can summarize as follows. URL integration using SWE always invokes refresh of Siebel Open UI client, this takes some time and reloads all javascript objects in the page. It means what some client customization uses javascript objects to store some data or context, with page reload it is lost. The second issue is, when user has ongoing editing of record, URL invocation and reload does not save his or her changes, this is very bothering. The third problem can be when then user session is hanging in some task, i.e. long query, it means webpage is not responsive, the URL invocation and reload leads to session warning window on client side and session is lost. The last limitation is that, once URL invocation is called with SWE attribute SWERF=1, the logic in the custom business service script must do GotoView, otherwise nasty alert window appears from Siebel Open UI framework during following user driven navigation. To prevent this, one has to write script that do some kind of self-refresh to let users stay with they work. Develop error prone function for Self-refresh is not a light task.
To summarize all these experience after more than half year of running in production, we have come with the improvement. The improvement lies in catching the CTI specific URL call in Chrome extension and converting it into Siebel PM script and execute directly within Siebel client javascript object SiebelApp.S_App. The extension code from http://www.ccw.sk/sk/blog/siebel-client-side-integration-using-chrome-extension.html can be adjusted, see following code snippet.
if (foundTab && foundTab.id != tabId) {
chrome.extension.getBackgroundPage().console.log(foundTab.id+":"+tabId);
if (requestUrl.indexOf("AgentNotifyInboundEvent")<0) {
chrome.tabs.update(foundTab.id, { url: requestUrl });
}
else {
var paramURL = requestUrl.substring(requestUrl.indexOf("?")+1);
paramURL = paramURL.replace(/%2B/g, '+');
chrome.tabs.executeScript(foundTab.id,{
code:"var script = document.createElement('script');
script.textContent = 'try { if
(SiebelApp.S_App.GetActiveView().GetActiveApplet()!=null &&
SiebelApp.S_App.GetActiveView().GetActiveApplet().GetPModel().ExecuteMethod
(\"CanInvokeMethod\",\"WriteRecord\"))
{ SiebelApp.S_App.GetActiveView().GetActiveApplet().GetPModel().ExecuteMethod
(\"InvokeMethod\",\"WriteRecord\", null, false);}
var oBS = SiebelApp.S_App.GetService(\"CTI URL Call Handler\");
var inpPS = SiebelApp.S_App.NewPropertySet();
inpPS.SetProperty(\"URL\", \"" + paramURL + "\" );
var outPS = SiebelApp.S_App.NewPropertySet();
oBS.InvokeMethod(\"ProcessJSCall\", inpPS, outPS); }
finally {inpPS = null; outPS = null; oBS = null; }';
(document.head||document.documentElement).appendChild(script); script.remove();"
});
}
chrome.tabs.update(foundTab.id, { url: requestUrl });
chrome.tabs.remove(tabId, function focusOnExisting() {
chrome.tabs.update(foundTab.id, {
active: true,
highlighted: true
});
chrome.windows.get(foundTab.windowId, function (window) {
if (!window.focused) {
chrome.windows.update(window.id, { focused: true });
}
});
});
retCancel = true;
}
All URL calls without substring "AgentNotifyInboundEvent" are redirected to already opened Siebel client window. If URL contains this substring, URL link is considered as CTI integration call and we do not call page reload with SWE command, but using chrome.tabs.executeScript we execute javascript code inside Siebel webpage. To call functions of SiebelApp.S_App we must inject code using element on page, which we create for this purpose, with
document.createElement('script'); script.textContent =..….
(document.head||document.documentElement).appendChild(script); script.remove();
Otherwise it is not allowed to access objects directly from the code of the extension. So the injected script is the only solution because of the security policy, for explanation please see: https://medium.com/front-end-weekly/how-do-chrome-extensions-modify-webpages-using-content-scripts-9ae278e2bdf8
This is the key know-how to execute Siebel business logic from Chrome extension. Then one can set in script.textContent whatever code to be executed on Siebel side. Firstly, we ensure that WriteMethod is allowed on current applet and if yes, we call WriteRecord of focused Business component to store the record. After this, we call custom business service method with all the CTI logic, to create call activity, identify the customer and navigate to his/her screen.
This manner of integration can be used on any type of Siebel client-site URL call integraton, for more detail and information, please contact us.
Back to Blog