JavaScript Popping - Immediate

 
If the order in which a series of activities are completed isn't important, then the activities can be popped immediately. This causes a new activity to be created with the popped Workflow in it, and the agent is then switched immediately into this new activity without closing any existing activities.
 
Unlike a URL pop, any existing activity is merely suspended rather than abandoned, and the created activities can be freely switched between using the activity list in the top-right corner of the Desktop. For example, this could be used to have an incoming call pop over the top of an in-progress low-priority email responder, with the agent able to handle the call and then return to the email when ready.
 
Important: This article covers a function that is intended for use by a plugin, and cannot be used from within a Workflow run as other Helper Functions can be. It is documented here for completeness.
 

How To

The syntax for popping via JavaScript is:
Desktop.Pop.CampaignByName(campaign, reference, data, connector, connectorType, restartScript);
 
The available parameters for this are:
Parameter
Required
Description
campaign
Required
The identifier of the Campaign or Campaign Alias to launch, this could be a Scripting campaign, a dialler list, or a SQL table.
reference
Optional
The reference of an existing record to launch. If a record with this reference does not exist, a new record will be created. If null or an empty string is passed, an automatically-generated reference of the form CSAUTO-#-#-# will be used for the new record. This will be the value of [var_csReference] in the popped Workflow.
data
Optional
If using Integration - Generic, then a JavaScript object containing data can be passed through to the queued Workflow run, which will map the values of any keys that match Workflow Variables or mapped fields. This will also be available through the Script.Data helper functions.
If no data is required, null or an empty object can be passed in.
connector
Optional
Specifies the connector_id that will be written to tbl_outbound_history for the record. This will be the value of [var_csConnectorID] in the popped Workflow.
connectorType
Optional
Specifies the connector_type that will be written to tbl_outbound_history for the record. This will be the value of [var_csConnectorType] in the popped Workflow.
restartScript
Optional
If set to true, the Workflow will start on the Start Page. If set to false and an existing reference is passed, the Workflow will pop on the page reached in the previous Workflow run. This is only typically set to false to carry on incomplete Workflow runs, and the Workflow must have been left without reaching the Last Page (for instance, via the Script.Finish() helper function) for this to work properly.
If set to null or an empty string, the default behaviour of true is used.
 
 
Example for SQL Plugin:
Desktop.Pop.CampaignByName("tbl_CustomerData", "4074");
 
Desktop.Pop.CampaignByName("GenericCampaign", null, {
    var_csCallerName: "Joe Bloggs",
    DaytimeNumber: "01234 567890"
});
 
This then immediately pops our Workflow over any current activity, and populates the values "Joe Bloggs" and "01234 567890" into [var_csCallerName] of the popped Workflow.
 
 
 

Notes

Upon exiting all JavaScript-queued Workflows, the agent will be returned to the Desktop.