blog image

Siebel client side integration using Chrome Extension

Oracle Siebel CRM offers many techniques for integrating client applications. The modern trend is to integrate more web-based applications on client side, instead of using server side integration. With the introduction of Open UI client side integrations are more and more interesting.

The most common and preferred integration technique is still URL call using SWE command. Siebel SWE offers the set of commands that enables navigation to view, invoking business service method, etc. For more details, see:

https://docs.oracle.com/cd/E14004_01/books/PortalFrame/PortalFrameDelConExtWebApps27.html

To find the browser window with Siebel, javascript method: window.open can be used. Using Internet Explorer, the window.open method always found the correct window or tab with Siebel Open UI application. Because that IE does not consider parent–child window relationship, it always finds the window with the window name specified in window.open function. On the other hand, Mozilla or Chrome implements some security, to do not find the window unless window to find is parent of window, where the window.open is triggered. See i.g. https://developer.mozilla.org/en-US/docs/Web/API/Window/open, otherwise Chrome opens new window with the URL.

When we want to make a jump back to Browser window with Siebel it is real issue, because second session is not allowed. To solve this issue and make client side integration feasible we have implemented custom Chrome Extension.

Firstly, we have to define Manifest file of the extension. We restrict the extension on Siebel URLs only, Section „permission“ is important .

   "permissions" : [
    "background",
    "tabs",
    "webRequest",
    "webNavigation",
    "webRequestBlocking",
    "storage",
    "browsingData",
    "https://*/fins_deu/start.swe*",
    "https://*/fins_fra/start.swe*",
    "https://*/fins_ita/start.swe*",
    "https://*/fins_enu/start.swe*",
    "https://*/callcenter_deu/start.swe*",  ],

   "update_url": "G:PROGChromeExtensionsMobi_Siebel_Singletonupdate.xml",

  "background": {
    "scripts": ["background.js"],
    "persistent": true
  },   

 The script of the extension registers the listener for onBeforeRequest , 

var sblTabFilter = "https://*/fins_*";
var sblUrlPattern = new RegExp("^https://vp.*/fins_");
var sblAppName = "/fins_";  // enu, deu, ita, fra - suffix 

chrome.webRequest.onBeforeRequest.addListener(function(a) {
  var retCancel = false;
  if (sblUrlPattern.test(a.url))
  {
     retCancel = checkOpenSiebel(a.tabId, a.url);
     if (retCancel) {
       return {redirectUrl:"javascript:"}
     }
  }
  return {cancel: false}
  },
  {urls: ["https://*/fins_deu/start.swe*", "https://*/fins_fra/start.swe*", "https://*/fins_ita/start.swe*", "https://*/fins_enu/start.swe*"]},
  ["blocking", "requestBody"]
); 

If request for loading page matches Siebel webpage then the function checkOpenSiebel is called. It searches through the tabs and if Siebel is open, request is redirected to the already opened Siebel tab. No new Siebel tab is open which can create conflict with Siebel session restriction

function checkOpenSiebel(tabId, requestUrl) // tabId - currently being opened tab, url - url for new tab
{
  try {
    var retCancel = false;
    var iPos = requestUrl.indexOf(sblAppName);
    if (iPos < 0) // not foundTab
      return false;         
    var requestServerUrl = requestUrl.substring(0, iPos + 9);   // +9 to include whole application name, e.g. /fins_enu
    chrome.tabs.query({ url : [sblTabFilter] },
      function closeCurrentTab(tabs)
      {         
        var foundTab = null;
        for (var i = 0; i < tabs.length; i++) {
          if ((foundTab==null || foundTab.id > tabs[i].id) && tabs[i].url.indexOf(requestServerUrl)==0)
          {           
            foundTab = tabs[i];
          }
        }
        if (foundTab && foundTab.id != tabId)
        {
          chrome.extension.getBackgroundPage().console.log(foundTab.id+":"+tabId);
          chrome.tabs.update(foundTab.id, { url: requestUrl }); 
          chrome.tabs.remove(tabId, function focusOnExisting() { //inject script
            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;
        }
      }); // end of query
    return retCancel;
  } catch (e) {
    alert(e);
  }
} 

Before we begin: take a look at the processing of your personal data

If you visit a site that records cookies, a small text file will be created on your computer and stored in your browser. The next time you visit the same page, it will help you connect to the web faster. Our website will offer you relevant information and make it easier for you to work.

We mainly use cookies for anonymous traffic analysis and to improve our website. If you set your browser to block cookies, it is possible that the website will slow down and some parts of the website may not work completely correctly. More info on the processing of cookies.