PureConnect

 View Only
Discussion Thread View
  • 1.  Scripter Auto Logon

    Posted 04-03-2019 16:02
    I have a problem in a custom script.  When the agent is set to Auto logon (Logon Campaign is unchecked), the scripter objects don't initialize correctly.  What do I need to call in the script to make sure all of the resources are initialized?

    Thanks,
    #Outbound

    ------------------------------
    Tim Cannon
    Elevate Credit Services, LLC
    ------------------------------


  • 2.  RE: Scripter Auto Logon

    Posted 04-04-2019 09:44
    Can you be more specific on how you are initializing these?
    Is this a SPA?

    I faintly remember years ago, I ran into issues using jQuery's document.ready, and instead had to put my init() function in the body.onload. I think an IIFE worked as well. You may want to experiment too with marking the agent ready for calls when you are sure your scripter objects are initialized. 


    ------------------------------
    Sean Walls
    ------------------------------



  • 3.  RE: Scripter Auto Logon

    Posted 04-04-2019 15:53
    It is an SPA and I'm using body.onload to fire init().  
    I am using a function callObjectAdded(CallObject){}
    to set some values based on the CallObject

    and the function IS_Event_NewPredictiveCall(){}
    to process the Event.

    When the agent does auto-logon, the CallObject in the function has no attributes.  And when I use the scripter.callObject in the IS_Event function it does not have attributes either.

    ------------------------------
    Tim Cannon
    Elevate Credit Services, LLC
    ------------------------------



  • 4.  RE: Scripter Auto Logon

    Posted 04-08-2019 09:34
    Can you provide a sample some of your code?

    Assuming you have all of the scripter actions/events defined in your meta tags correctly, and there is a Predictive Call Event happening this should work. 

    I know previously I had issues even just getting the IS_System_AgentId.value in my init function on my waiting page.

    ------------------------------
    Sean Walls
    ------------------------------



  • 5.  RE: Scripter Auto Logon

    Posted 04-08-2019 16:12
    It's not the whole page, but should have the relevant parts.
    Meta tags are defined before the script.
    The script begins by setting onload = init, then setting some global variables.

    init runs some functions to set up the status change selection and the disposition radio buttons.
    __________________________________________
    If the agent logs in via Campaign|Log On|[Choose Campaign]
    Two handlers are executed:
    IS_Event_NewPredictiveCall()
    The scripter objects (IS_ATTR_FirstName.value, etc.) are used to set values in the page.
    callObjectAdded(CallObject)
    the CallObject parameter is used to set values in the page (document.getElementById("NUMBERDIALED").innerText = CallObject.remoteId;)
    __________________________________________
    If the agent has the Security right [Logon Campaign] checked (so that he is auto-logged into all available campaigns, there is only one available campaign in our test)
    Two handlers are executed:
    IS_Event_NewPredictiveCall()
    The scripter objects (IS_ATTR_FirstName.value, etc.) are used to set values in the page.

    callObjectAdded(CallObject)
    when attributes of the CallObject are addressed (CallObject.remoteId;) an error is thrown (Automation is not supported on null values)
    __________________________________________
    The end result is that I get different results based on how the agent logs in.

    //Meta Tags
    	<meta name="IS_Action_ClientStatus">
    	<meta name="IS_Action_Pickup">
    	<meta name="IS_Action_SetForeground">
    	<meta name="IS_Action_SelectPage">
    	<meta name="IS_Action_RequestBreak">
    	<meta name="IS_Action_EndBreak">
    	<meta name="IS_Action_RequestLogoff">
    	<meta name="IS_Action_Disconnect">
    	<meta name="IS_Action_CallComplete">
    	<meta name="IS_Action_Close">
    	<meta name="IS_Action_Transfer">
    	
    	
    	<meta name="IS_System_AgentID">
    	<meta name="IS_System_ClientStatus">
    	
    	<meta name="IS_ATTR_Callid">
    	<meta name="IS_ATTR_CampaignName">
    	<meta name="IS_ATTR_FirstName">
    	<meta name="IS_ATTR_LastName">
    	<meta name="IS_ATTR_CustomerAccountNumber">
    	<meta name="IS_ATTR_WorkPhoneNumber">
    	<meta name="IS_ATTR_numbertodial">
    	<meta name="IS_ATTR_phonenumbertype">
    	<meta name="is_attr_ElevateNumber">
    	<meta name="IS_ATTR_AccountNumber">
    	<meta name="IS_ATTR_LOANNUMBER">
    	<meta name="IS_ATTR_CITY">
    	<meta name="IS_ATTR_STATE">
    	<meta name="IS_ATTR_PORTFOLIOID">
    	
    
    <script language="javascript">
    
    window.onload = init;
    var h = 0;
    var m = 0;
    var s = 0;
    var strBreakStatus = "";
    var baseURL = "https://test.application.com/agent/html/loadEntity?"
    var doScreenPop = "NO"
    var queryANI = "ani="
    var queryPortfolio = "portfolioId="
    var queryAccount = "acct="
    var currentID = "";
    
    
    function init() {
    
    	// Build status change dropdown list
    	buildStatus();
    	// Assign Handlers
    	// User Status Change
    	scripter.myUser.statusChangeHandler = userStatusChange;
    	// Call Object Added
    	scripter.myQueue.callObjectAddedHandler = callObjectAdded;
    	// Call Object State Change
    	scripter.callObject.stateChangeHandler = stateChange
    	// build disposition radio buttons
    	buildDisposition();
    	//Set Values in the UI
    	document.getElementById("GREETING").innerHTML = "<h2>Waiting for call </h2>"
    	setInterval('Timer();', 1000);
    	SetTag();
    }
    
    function callObjectAdded(CallObject){
    	// Set values based on attributes of the new call
    	document.getElementById("NUMBERDIALED").innerText = CallObject.remoteId;
    	baseURL = CallObject.getAttribute('ELE_BaseURL')
    	doScreenPop = CallObject.getAttribute('ELE_DoScreenPOP')
    	queryANI = queryANI + (CallObject.remoteId).replace(/\D/g,'')
    	currentID = CallObject.id;
    }
    function IS_Event_NewPredictiveCall()
    {
        // bring the app window to the top
        IS_Action_SetForeground.click();
    
        // bring this tab page to the top
        IS_Action_SelectPage.click();
    
        // Pickup the call
    	IS_Action_Pickup.click();
    
        // build the display for the predictive pop
    	var strHTML = 'Hello this is [Agent], can I speak to [FirstName] [LastName]<br/>'
    	strHTML = 'Hello, may I speak with [FirstName] [LastName]<br/>'
    	strHTML = strHTML.replace("[FirstName]", IS_ATTR_FirstName.value);
    	strHTML = strHTML.replace("[LastName]", IS_ATTR_LastName.value);
    	strHTML = strHTML.replace("[PhoneNumberType]", is_attr_phonenumbertype.value);
    	// Set some values............
    	document.getElementById("CAMPAIGNNAME").innerHTML = "<h1>Campaign: " + IS_ATTR_CampaignName.value + "</h1>";
    	document.getElementById("PHONENUMBERTYPE").innerText = is_attr_phonenumbertype.value;
    	document.getElementById("ACCOUNTNUMBER").innerText = IS_ATTR_AccountNumber.value;
    	document.getElementById("LOANNUMBER").innerText = IS_ATTR_LOANNUMBER.value;
    	document.getElementById("CITY").innerText = IS_ATTR_CITY.value;
    	document.getElementById("STATE").innerText = IS_ATTR_STATE.value;
    	var CallObject = scripter.callObject;
    	//Build the screenpop
    	queryANI = queryANI;
    	queryAccount = queryAccount + IS_ATTR_AccountNumber.value;
    	queryPortfolio = queryPortfolio + IS_ATTR_PORTFOLIOID.value;	 
    	var TransferURL = baseURL + queryANI + "&" + queryAccount + "&" + queryPortfolio
    	
    	document.getElementById("GREETING").innerHTML = strHTML;
    	
    	document.getElementById("callstatus").innerText = CallObject.stateString;
    	//Finally, do the screenpop, or not....
    	if (doScreenPop == "YES"){
    		window.open(TransferURL,'KatabatPop','',true)
    	}else{
    		document.getElementById("SCREENPOP").innerText = TransferURL;
    	}
    
    }
    </script>


    ------------------------------
    Tim Cannon
    Elevate Credit Services, LLC
    ------------------------------



  • 6.  RE: Scripter Auto Logon

    Posted 04-08-2019 16:56
    I am not seeing anything that stands out. The error received is on the line below?

    document.getElementById("NUMBERDIALED").innerText = CallObject.remoteId;


    That you are seeing an error referencing "Automation" though, leads me to believe your script is fine, but something in the environment may not be. As an example, I have to perform certain screen pops in different browsers. To do so I used the WScript.exe in an ActiveX Object with the specific browsers application. If the users' permission did not enable certain ActiveX controls in internet options, the script would pop an "Automation cannot create server" or something similar. To fix this, we had to go into each user, and enable ActiveX controls.



    ------------------------------
    Sean Walls
    ------------------------------



  • 7.  RE: Scripter Auto Logon

    Posted 04-24-2019 12:25
    Thanks for your help in discussing this.
    TLDR version: The correct prototype is IS_Event_NewPredictiveCall(CallId), and don't use IS_Event_NewPredictiveCall and CallObjectAdded in parallel to set values in a page.

    My root problem was that I was using the IS_Event_NewPredictiveCall() without CallID (The prototype is IS_Event_NewPredictiveCall(CallId)).

    Because of this, I was using CallObjectAdded(CallObject) to get a reference to the call object.  It seems that this caused a race condition where sometimes the reference was not set when the function needed it.

    I removed CallObjectAdded(CallObject) and set IS_Event_NewPredictiveCall(CallId) correctly.  Then used the CallId to obtain a reference to the CallObject and get the attributes for display.

    ------------------------------
    Tim Cannon
    Elevate Credit Services, LLC
    ------------------------------



Need Help finding something?

Check out the Genesys Knowledge Network - your all-in-one access point for Genesys resources