Created
June 8, 2014 09:25
-
-
Save ankamguru/773bc4615e0463b1df34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///======================================== | |
/// SoftPhone s.r.l | |
/// IWSConnector release 1.1.4.0 | |
/// Date: 08/08/2013 | |
///======================================== | |
// CHECK IF THE IWS AGENT IS THE SAME LOGGED IN SIEBEL | |
// WITHOUT AGENT INTEGRITY THE AGENT IS LOGGED OUT | |
/** | |
* CheckAgentIntegrity | |
* @param msg | |
*/ | |
function CheckAgentIntegrity(message) | |
{ | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var propin = myapp.NewPropertySet(); | |
var propout = myapp.NewPropertySet(); | |
propin.SetProperty("UserNameIws", message.UserName); | |
propout = myser.InvokeMethod("CheckIWSUser", propin); | |
var retValue = propout.GetProperty("RetValue"); | |
if( retValue != "true") | |
{ | |
alert("Siebel UserName is not the same of the iWS UserName, Logout and Login again!"); | |
myapp.InvokeMethod("Logoff"); | |
} | |
} | |
// SCREEN POP BASED ON ANI FOR CONTACT | |
/** | |
* InboundContactPopUpANI | |
* @param message | |
*/ | |
function InboundContactPopUpANI(message) | |
{ | |
try | |
{ | |
log.info("Executing InboundContactPopUpANI..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var propin = myapp.NewPropertySet(); | |
var propout = myapp.NewPropertySet(); | |
var activity = myapp.NewPropertySet(); | |
activity.SetProperty("Call Id", message.ConnectionID); | |
activity.SetProperty("IWS MediaType", "Voice"); | |
activity.SetProperty("Type", "Call - Inbound"); | |
activity.SetProperty("Status", "In Progress"); | |
activity.SetProperty("Description", "Call Inbound from " + message.ANI + " - ConnectionId: " + message.ConnectionID); | |
propin.AddChild(activity); | |
propin.SetProperty("BONR","Action"); | |
propin.SetProperty("BCNR", "Action"); | |
propin.SetProperty("FieldName","Work Phone #"); | |
propin.SetProperty("FieldValue", message.ANI ); | |
propin.SetProperty("ViewName","Contact Detail View"); | |
propin.SetProperty("ViewNameNoRecords","Activity List View"); | |
propin.SetProperty("MultiViewName","Contact List View"); | |
propout = myser.InvokeMethod("ShowContactAndAction", propin); | |
var contactId = myapp.GetProfileAttr("IWS_ContactId"); | |
var activityId = myapp.GetProfileAttr("IWS_ActivityId"); | |
var myCollection = createUserData(); | |
if(activityId) | |
myCollection.put("ACTIVITY_ID",activityId); | |
if(contactId) | |
myCollection.put("CONTACT_ID",contactId); | |
if(!myCollection.isEmpty()) | |
SetAttachdataById(message.ConnectionID,myCollection); | |
log.debugFormat("Attaccati: ACTIVITY_ID= {0} AND CONTACT_ID={1}",activityId,contactId); | |
myCollection = null; | |
contactId = null; | |
activityId = null; | |
propin = null; | |
propout = null; | |
activity = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// SCREEN POP BASED ON CONTACT_ID | |
/** | |
* InboundContactPopUpContactId | |
* @param message | |
*/ | |
function InboundContactPopUpContactId(message) | |
{ | |
try | |
{ | |
log.info("Executing InboundContactPopUpContactId..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var propin = myapp.NewPropertySet(); | |
var propout = myapp.NewPropertySet(); | |
if(message.attachdata.ACTIVITY_ID) | |
{ | |
propin.SetProperty("BOName","Contact"); | |
propin.SetProperty("BCName", "Contact"); | |
propin.SetProperty("FieldName",""); | |
propin.SetProperty("FieldValue", ""); | |
propin.SetProperty("PrimaryRow", message.attachdata.CONTACT_ID); | |
propin.SetProperty("ViewName","Contact Detail View"); | |
propin.SetProperty("ViewNameNoRecords","Contact List View"); | |
propin.SetProperty("MultiViewName","Contact List View"); | |
propout = myser.InvokeMethod("ShowGeneralEntity", propin); | |
} else | |
{ | |
var activity = myapp.NewPropertySet(); | |
activity.SetProperty("Call Id", message.ConnectionID); | |
activity.SetProperty("IWS MediaType", "Voice"); | |
activity.SetProperty("Type", "Call - Inbound"); | |
activity.SetProperty("Status", "In Progress"); | |
activity.SetProperty("Description", "Call Inbound from " + message.ANI + " - ConnectionId: " + message.ConnectionID); | |
propin.AddChild(activity); | |
propin.SetProperty("FieldName",""); | |
propin.SetProperty("FieldValue", ""); | |
propin.SetProperty("PrimaryRow", message.attachdata.CONTACT_ID); | |
propin.SetProperty("ViewName","Contact Detail View"); | |
propin.SetProperty("ViewNameNoRecords","Contact List View"); | |
propin.SetProperty("MultiViewName","Contact List View"); | |
propout = myser.InvokeMethod("ShowContactAndAction", propin); | |
var activityId = myapp.GetProfileAttr("IWS_ActivityId"); | |
var myCollection = createUserData(); | |
if(activityId) | |
myCollection.put("ACTIVITY_ID",activityId); | |
if(!myCollection.isEmpty()) | |
SetAttachdataById(message.ConnectionID,myCollection); | |
activityId = null; | |
} | |
myCollection = null; | |
propin = null; | |
propout = null; | |
activity = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// RELEASE CALL HANDLING | |
/** | |
* ReleaseCall | |
* @param message | |
*/ | |
function ReleaseCall(message) | |
{ | |
try | |
{ | |
log.info("Executing ReleaseCall..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var psIn = myapp.NewPropertySet(); | |
var psOut = myapp.NewPropertySet(); | |
var psActivity = myapp.NewPropertySet(); | |
psActivity.SetProperty("Status", "Done"); | |
psIn.AddChild(psActivity); | |
psIn.SetProperty("PrimaryRow", message.attachdata.ACTIVITY_ID); | |
psOut = myser.InvokeMethod("UpdateActivity", psIn); | |
myapp.SetProfileAttr("IWS_ContactId", ""); | |
myapp.SetProfileAttr("IWS_RecordId", ""); | |
myapp.SetProfileAttr("IWS_ActivityId", ""); | |
myapp.SetProfileAttr("IWS_AccountId", ""); | |
psIn = null; | |
psOut = null; | |
psActivity = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// SCREEN POP BASED ON DNIS ON CONTACT | |
/** | |
* OutboundContactPopUpDNIS | |
* @param message | |
*/ | |
function OutboundContactPopUpDNIS(message) | |
{ | |
try | |
{ | |
log.info("Executing OutboundContactPopUpDNIS..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var propin = myapp.NewPropertySet(); | |
var propout = myapp.NewPropertySet(); | |
var activity = myapp.NewPropertySet(); | |
activity.SetProperty("Call Id", message.ConnectionID); | |
activity.SetProperty("IWS MediaType", "Voice"); | |
activity.SetProperty("Type", "Call - Outbound"); | |
activity.SetProperty("Status", "In Progress"); | |
activity.SetProperty("Description", "Call Outbound to " + message.DNIS + " - ConnectionId: " + message.ConnectionID); | |
propin.AddChild(activity); | |
propin.SetProperty("BONR","Action"); | |
propin.SetProperty("BCNR", "Action"); | |
propin.SetProperty("FieldName","Work Phone #"); | |
propin.SetProperty("FieldValue", message.DNIS); | |
propin.SetProperty("ViewName","Contact Detail View"); | |
propin.SetProperty("ViewNameNoRecords","Activity List View"); | |
propin.SetProperty("MultiViewName","Contact List View"); | |
propout = myser.InvokeMethod("ShowContactAndAction", propin); | |
var contactId = myapp.GetProfileAttr("IWS_ContactId"); | |
var activityId = myapp.GetProfileAttr("IWS_ActivityId"); | |
var myCollection = createUserData(); | |
if(activityId) | |
myCollection.put("ACTIVITY_ID",activityId); | |
if(contactId) | |
myCollection.put("CONTACT_ID",contactId); | |
if(!myCollection.isEmpty()) | |
SetAttachdataById(message.ConnectionID,myCollection); | |
myCollection = null; | |
contactId = null; | |
activityId = null; | |
propin = null; | |
propout = null; | |
activity = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// SCREEN POP SR | |
/** | |
* WorkitemSRPopUp | |
* @param message | |
*/ | |
function WorkitemSRPopUp(message) | |
{ | |
try { | |
log.info("Executing WorkitemSRPopUp..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var propin = myapp.NewPropertySet(); | |
var propout = myapp.NewPropertySet(); | |
var activity = myapp.NewPropertySet(); | |
var myCollection = createUserData(); | |
activity.SetProperty("Call Id", message.ConnectionID); // ?!? | |
activity.SetProperty("IWS MediaType", "Workitem"); // ?!? | |
activity.SetProperty("Activity SR Id", message.attachdata.SRRowId); | |
activity.SetProperty("Status", "In Progress"); // ?!? | |
activity.SetProperty("Type", "Information"); | |
activity.SetProperty("Description", "Workitem"); | |
activity.SetProperty("Comments", "Workitem Inbound for SR # " + message.attachdata.ExternalId + " - Priority: " + message.attachdata.Priority + " - Skill: " + message.attachdata.IWD_ext_requestedSkill + " - InteractionId: " + message.InteractionID); | |
propin.AddChild(activity); | |
propin.SetProperty("BOName","Service Request"); | |
propin.SetProperty("BCName", "Service Request"); | |
propin.SetProperty("BONR","Action"); | |
propin.SetProperty("BCNR", "Action"); | |
propin.SetProperty("AgentId", message.AgentID); | |
propin.SetProperty("PrimaryRow", message.attachdata.SRRowId); | |
propin.SetProperty("ViewName","Service Request Detail View"); | |
propin.SetProperty("ViewNameNoRecords","All Service Request across Organizations"); | |
propin.SetProperty("MultiViewName","All Service Request across Organizations"); | |
propout = myser.InvokeMethod("ShowSRAndUpdate", propin); | |
var activityId = myapp.GetProfileAttr("IWS_ActivityId"); | |
var accountId = myapp.GetProfileAttr("IWS_AccountId"); | |
if(activityId) | |
myCollection.put("SIEBEL_ACTIVITY_ID",activityId); | |
if(accountId) | |
myCollection.put("SIEBEL_ACCOUNT_ID",accountId); | |
if (!myCollection.isEmpty()) | |
SetAttachdataById(message.ConnectionID, myCollection); | |
log.debugFormat("Attached: ACTIVITY_ID={0} AND ACCOUNT_ID={1}",activityId, accountId); | |
myCollection = null; | |
activityId = null; | |
accountId = null; | |
propin = null; | |
propout = null; | |
activity = null; | |
myser = null; | |
myapp = null; | |
} catch(e) { | |
log.error("Exception " + e.message); | |
} | |
} | |
// SCREEN POP BASED ON ANI FOR ACCOUNT | |
/** | |
* InboundAccountPopUpANI | |
* @param message | |
*/ | |
function InboundAccountPopUpANI(message) | |
{ | |
try | |
{ | |
log.info("Executing InboundAccountPopUpANI..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var propin = myapp.NewPropertySet(); | |
var propout = myapp.NewPropertySet(); | |
var activity = myapp.NewPropertySet(); | |
activity.SetProperty("Call Id", message.ConnectionID); | |
activity.SetProperty("IWS MediaType", "Voice"); | |
activity.SetProperty("Type", "Call - Inbound"); | |
activity.SetProperty("Status", "In Progress"); | |
activity.SetProperty("Description", "Call Inbound from " + message.ANI + " - ConnectionId: " + message.ConnectionID); | |
propin.AddChild(activity); | |
propin.SetProperty("BONR","Action"); | |
propin.SetProperty("BCNR", "Action"); | |
propin.SetProperty("FieldName","Main Phone Number"); | |
propin.SetProperty("FieldValue", "*"); | |
propin.SetProperty("ViewName","Account Detail - Activities View"); | |
propin.SetProperty("ViewNameNoRecords","Activity List View"); | |
propin.SetProperty("MultiViewName","Account List View"); | |
propout = myser.InvokeMethod("ShowAccountAndAction", propin); | |
var accountId = myapp.GetProfileAttr("IWS_AccountId"); | |
var activityId = myapp.GetProfileAttr("IWS_ActivityId"); | |
var myCollection = createUserData(); | |
if(activityId) | |
myCollection.put("ACTIVITY_ID",activityId); | |
if(accountId) | |
myCollection.put("ACCOUNT_ID",accountId); | |
if(!myCollection.isEmpty()) | |
SetAttachdataById(message.ConnectionID,myCollection); | |
myCollection = null; | |
accountId = null; | |
activityId = null; | |
propin = null; | |
propout = null; | |
activity = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// SCREEN POP BASED ON ACCOUNT_ID | |
/** | |
* InboundAccountPopUpAccountId | |
* @param message | |
*/ | |
function InboundAccountPopUpAccountId(message) | |
{ | |
try | |
{ | |
log.info("Executing InboundAccountPopUpAccountId..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var propin = myapp.NewPropertySet(); | |
var propout = myapp.NewPropertySet(); | |
if(message.attachdata.ACTIVITY_ID) | |
{ | |
propin.SetProperty("BOName","Account"); | |
propin.SetProperty("BCName", "Account"); | |
propin.SetProperty("PrimaryRow", message.attachdata.ACCOUNT_ID); | |
propin.SetProperty("ViewName","Account Detail - Activities View"); | |
propin.SetProperty("ViewNameNoRecords","Activity List View"); | |
propin.SetProperty("MultiViewName","Account List View"); | |
propout = myser.InvokeMethod("ShowGeneralEntity", propin); | |
} | |
else | |
{ | |
var activity = myapp.NewPropertySet(); | |
activity.SetProperty("Call Id", message.ConnectionID); | |
activity.SetProperty("IWS MediaType", "Voice"); | |
activity.SetProperty("Type", "Call - Inbound"); | |
activity.SetProperty("Status", "In Progress"); | |
activity.SetProperty("Description", "Transferred Call Inbound from " + message.ANI + " - ConnectionId: " + message.ConnectionID); | |
propin.AddChild(activity); | |
propin.SetProperty("BONR","Action"); | |
propin.SetProperty("BCNR", "Action"); | |
propin.SetProperty("FieldName",""); | |
propin.SetProperty("FieldValue", ""); | |
propin.SetProperty("PrimaryRow", message.attachdata.ACCOUNT_ID); | |
propin.SetProperty("ViewName","Account Detail - Activities View"); | |
propin.SetProperty("ViewNameNoRecords","Activity List View"); | |
propin.SetProperty("MultiViewName","Account List View"); | |
propout = myser.InvokeMethod("ShowAccountAndAction", propin); | |
var activityId = myapp.GetProfileAttr("IWS_ActivityId"); | |
var myCollection = createUserData(); | |
if(activityId) | |
myCollection.put("ACTIVITY_ID",activityId); | |
if(!myCollection.isEmpty()) | |
SetAttachdataById(message.ConnectionID,myCollection); | |
myCollection = null; | |
activityId = null; | |
activity = null; | |
} | |
propin = null; | |
propout = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// SCREEN POP BASED ON DNIS ON ACCOUNT | |
/** | |
* OutboundAccountPopUpDNIS | |
* @param message | |
*/ | |
function OutboundAccountPopUpDNIS(message) | |
{ | |
try | |
{ | |
log.info("Executing OutboundAccountPopUpDNIS..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var propin = myapp.NewPropertySet(); | |
var propout = myapp.NewPropertySet(); | |
var activity = myapp.NewPropertySet(); | |
activity.SetProperty("Call Id", message.ConnectionID); | |
activity.SetProperty("IWS MediaType", "Voice"); | |
activity.SetProperty("Type", "Call - Outbound"); | |
activity.SetProperty("Status", "In Progress"); | |
activity.SetProperty("Description", "Call Outbound to " + message.DNIS + " - ConnectionId: " + message.ConnectionID); | |
propin.AddChild(activity); | |
propin.SetProperty("BONR","Action"); | |
propin.SetProperty("BCNR", "Action"); | |
propin.SetProperty("FieldName","Main Phone Number"); | |
propin.SetProperty("FieldValue", message.DNIS); | |
propin.SetProperty("ViewName","Account Detail - Activities View"); | |
propin.SetProperty("ViewNameNoRecords","Activity List View"); | |
propin.SetProperty("MultiViewName","Account List View"); | |
propout = myser.InvokeMethod("ShowAccountAndAction", propin); | |
var accountId = myapp.GetProfileAttr("IWS_AccountId"); | |
var activityId = myapp.GetProfileAttr("IWS_ActivityId"); | |
var myCollection = createUserData(); | |
if(activityId) | |
myCollection.put("ACTIVITY_ID",activityId); | |
if(accountId) | |
myCollection.put("ACCOUNT_ID",accountId); | |
if(!myCollection.isEmpty()) | |
SetAttachdataById(message.ConnectionID,myCollection); | |
myCollection = null; | |
accountId = null; | |
activityId = null; | |
propin = null; | |
propout = null; | |
activity = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// CHAT SCREEN POP BASED ON EMAIL ADDRESS FOR CONTACT WITH ACTIVITY CREATION | |
/** | |
* ChatContactPopUpEmailAddressAct | |
* @param message | |
*/ | |
function ChatContactPopUpEmailAddressAct(message) | |
{ | |
try | |
{ | |
log.info("Executing ChatContactPopUpEmailAddressAct..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var propin = myapp.NewPropertySet(); | |
var propout = myapp.NewPropertySet(); | |
var activity = myapp.NewPropertySet(); | |
activity.SetProperty("Call Id", message.InteractionID); | |
activity.SetProperty("IWS MediaType", "Chat"); | |
activity.SetProperty("Type", "Text Chat"); | |
activity.SetProperty("Status", "In Progress"); | |
activity.SetProperty("Description", "Chat " + message.InteractionID + " : Subject: " + message.attachdata.Subject); | |
propin.AddChild(activity); | |
propin.SetProperty("BONR","Action"); | |
propin.SetProperty("BCNR", "Action"); | |
propin.SetProperty("FieldName","Email Address"); | |
propin.SetProperty("FieldValue", message.attachdata.EmailAddress); | |
propin.SetProperty("ViewName","Contact Detail View"); | |
propin.SetProperty("ViewNameNoRecords","Activity List View"); | |
propin.SetProperty("MultiViewName","Contact List View"); | |
propin.SetProperty("InteractionID", message.InteractionID); | |
propout = myser.InvokeMethod("ShowContactAndAction", propin); | |
var contactId = myapp.GetProfileAttr("IWS_ContactId"); | |
var activityId = myapp.GetProfileAttr("IWS_ActivityId"); | |
var myCollection = createUserData(); | |
if(activityId) | |
myCollection.put("ACTIVITY_ID",activityId); | |
if(contactId) | |
myCollection.put("CONTACT_ID",contactId); | |
if(!myCollection.isEmpty()) | |
SetAttachdataById(message.ConnectionID,myCollection); | |
myCollection = null; | |
contactId = null; | |
activityId = null; | |
propin = null; | |
propout = null; | |
activity = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// CHAT SCREEN POP BASED ON EMAIL ADDRESS FOR CONTACT | |
/** | |
* ChatContactPopUpEmailAddress | |
* @param message | |
*/ | |
function ChatContactPopUpEmailAddress(message) | |
{ | |
try | |
{ | |
log.info("Executing ChatContactPopUpEmailAddress..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var propin = myapp.NewPropertySet(); | |
var propout = myapp.NewPropertySet(); | |
propin.SetProperty("BOName","Contact"); | |
propin.SetProperty("BCName", "Contact"); | |
propin.SetProperty("BONR","Action"); | |
propin.SetProperty("BCNR", "Action"); | |
propin.SetProperty("FieldName","Email Address"); | |
propin.SetProperty("FieldValue", message.attachdata.EmailAddress); | |
propin.SetProperty("ViewName","Contact Detail View"); | |
propin.SetProperty("ViewNameNoRecords","Activity List View"); | |
propin.SetProperty("MultiViewName","Contact List View"); | |
propin.SetProperty("InteractionID", message.InteractionID); | |
propout = myser.InvokeMethod("ShowGeneralEntity", propin); | |
propin = null; | |
propout = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// CHAT SCREEN POP BASED ON CONTACT_ID | |
/** | |
* ChatContactPopUpContactId | |
* @param message | |
*/ | |
function ChatContactPopUpContactId(message) | |
{ | |
try | |
{ | |
log.info("Executing ChatContactPopUpContactId..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var propin = myapp.NewPropertySet(); | |
var propout = myapp.NewPropertySet(); | |
if(message.attachdata.ACTIVITY_ID) //ACTIVITY WAS ALREADY CREATED | |
{ | |
propin.SetProperty("BOName","Contact"); | |
propin.SetProperty("BCName", "Contact"); | |
propin.SetProperty("FieldName",""); | |
propin.SetProperty("FieldValue", ""); | |
propin.SetProperty("PrimaryRow", message.attachdata.CONTACT_ID); | |
propin.SetProperty("ViewName","Contact Detail View"); | |
propin.SetProperty("ViewNameNoRecords","Contact List View"); | |
propin.SetProperty("MultiViewName","Contact List View"); | |
propin.SetProperty("InteractionID", message.InteractionID); | |
propout = myser.InvokeMethod("ShowGeneralEntity", propin); | |
} else | |
{ | |
var activity = myapp.NewPropertySet(); | |
activity.SetProperty("Call Id", message.InteractionID); | |
activity.SetProperty("IWS MediaType", "Chat"); | |
activity.SetProperty("Type", "Text Chat"); | |
activity.SetProperty("Status", "In Progress"); | |
activity.SetProperty("Description", "Chat " + message.InteractionID + " : Subject: " + message.attachdata.Subject); | |
propin.AddChild(activity); | |
propin.SetProperty("FieldName",""); | |
propin.SetProperty("FieldValue", ""); | |
propin.SetProperty("PrimaryRow", message.attachdata.CONTACT_ID); | |
propin.SetProperty("ViewName","Contact Detail View"); | |
propin.SetProperty("ViewNameNoRecords","Contact List View"); | |
propin.SetProperty("MultiViewName","Contact List View"); | |
propin.SetProperty("InteractionID", message.InteractionID); | |
propout = myser.InvokeMethod("ShowContactAndAction", propin); | |
var activityId = myapp.GetProfileAttr("IWS_ActivityId"); | |
var myCollection = createUserData(); | |
if(activityId) | |
myCollection.put("ACTIVITY_ID",activityId); | |
if(!myCollection.isEmpty()) | |
SetAttachdataById(message.ConnectionID,myCollection); | |
activityId = null; | |
} | |
myCollection = null; | |
propin = null; | |
propout = null; | |
activity = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// RELEASE CHAT HANDLING | |
/** | |
* ReleaseChat | |
* @param message | |
*/ | |
function ReleaseChat(message) | |
{ | |
try | |
{ | |
log.info("Executing ReleaseChat..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var psIn = myapp.NewPropertySet(); | |
var psOut = myapp.NewPropertySet(); | |
var psActivity = myapp.NewPropertySet(); | |
psActivity.SetProperty("Status", "Done"); | |
psIn.AddChild(psActivity); | |
psIn.SetProperty("PrimaryRow", message.attachdata.ACTIVITY_ID); | |
psIn.SetProperty("InteractionID", message.InteractionID); | |
psOut = myser.InvokeMethod("UpdateActivity", psIn); | |
myapp.SetProfileAttr("IWS_ContactId", ""); | |
myapp.SetProfileAttr("IWS_ActivityId", ""); | |
myapp.SetProfileAttr("IWS_AccountId", ""); | |
psIn = null; | |
psOut = null; | |
psActivity = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// CHAT TRANSCRIPT HANDLING | |
/** | |
* ChatTranscriptAttachment | |
* @param message | |
*/ | |
function ChatTranscriptAttachment(message) | |
{ | |
try | |
{ | |
log.info("Executing ChatTranscriptAttachment..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var psIn = myapp.NewPropertySet(); | |
var psOut = myapp.NewPropertySet(); | |
psIn.SetProperty("PrimaryRow", message.attachdata.ACTIVITY_ID); | |
psIn.SetProperty("TranscriptFilePath", message.TranscriptPath); | |
psIn.SetProperty("InteractionID", message.InteractionID); | |
psOut = myser.InvokeMethod("ChatTranscriptAttachment", psIn); | |
psIn = null; | |
psOut = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// EMAIL SCREEN POP BASED ON EMAIL ADDRESS FOR CONTACT WITH ACTIVITY CREATION | |
/** | |
* EmailContactPopUpEmailAddressAct | |
* @param message | |
*/ | |
function EmailContactPopUpEmailAddressAct(message) | |
{ | |
try | |
{ | |
log.info("Executing EmailContactPopUpEmailAddressAct..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var propin = myapp.NewPropertySet(); | |
var propout = myapp.NewPropertySet(); | |
var activity = myapp.NewPropertySet(); | |
activity.SetProperty("Call Id", message.InteractionID); | |
activity.SetProperty("IWS MediaType", "Email"); | |
activity.SetProperty("Type", "Email - Inbound"); | |
activity.SetProperty("Status", "In Progress"); | |
activity.SetProperty("ParentId", message.EntrepriseInteractionCurrent.ParentID); | |
activity.SetProperty("Description", "Email " + message.InteractionID + " : Subject: " + message.attachdata.Subject); | |
propin.AddChild(activity); | |
propin.SetProperty("BONR","Action"); | |
propin.SetProperty("BCNR", "Action"); | |
propin.SetProperty("FieldName","Email Address"); | |
propin.SetProperty("FieldValue", message.attachdata.EmailAddress); | |
propin.SetProperty("ViewName","Contact Detail View"); | |
propin.SetProperty("ViewNameNoRecords","Activity List View"); | |
propin.SetProperty("MultiViewName","Contact List View"); | |
propin.SetProperty("InteractionID", message.InteractionID); | |
propout = myser.InvokeMethod("EmailShowContactAndAction", propin); | |
var contactId = myapp.GetProfileAttr("IWS_ContactId"); | |
var activityId = myapp.GetProfileAttr("IWS_ActivityId"); | |
var myCollection = createUserData(); | |
if(activityId) | |
myCollection.put("ACTIVITY_ID",activityId); | |
if(contactId) | |
myCollection.put("CONTACT_ID",contactId); | |
if(!myCollection.isEmpty()) | |
SetAttachdataById(message.ConnectionID,myCollection); | |
myCollection = null; | |
contactId = null; | |
activityId = null; | |
propin = null; | |
propout = null; | |
activity = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// REPLY EMAIL SCREEN POP BASED ON EMAIL ADDRESS FOR CONTACT WITH ACTIVITY CREATION | |
/** | |
* EmailReplyContactPopUpEmailAddressAct | |
* @param message | |
*/ | |
function EmailReplyContactPopUpEmailAddressAct(message) | |
{ | |
try | |
{ | |
log.info("Executing EmailReplyContactPopUpEmailAddressAct..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var propin = myapp.NewPropertySet(); | |
var propout = myapp.NewPropertySet(); | |
var activity = myapp.NewPropertySet(); | |
activity.SetProperty("Call Id", message.InteractionID); | |
activity.SetProperty("IWS MediaType", "Email"); | |
activity.SetProperty("Type", "Email - Outbound"); | |
activity.SetProperty("Status", "In Progress"); | |
activity.SetProperty("ParentId", message.EntrepriseInteractionCurrent.ParentID); | |
activity.SetProperty("Description", "Reply Email " + message.InteractionID + " : Subject: " + message.attachdata.Subject); | |
propin.AddChild(activity); | |
propin.SetProperty("FieldName",""); | |
propin.SetProperty("FieldValue", ""); | |
propin.SetProperty("BONR","Action"); | |
propin.SetProperty("BCNR", "Action"); | |
propin.SetProperty("PrimaryRow", message.attachdata.CONTACT_ID); | |
propin.SetProperty("ViewName","Contact Detail View"); | |
propin.SetProperty("ViewNameNoRecords","Activity List View"); | |
propin.SetProperty("MultiViewName","Contact List View"); | |
propin.SetProperty("InteractionID", message.InteractionID); | |
propout = myser.InvokeMethod("EmailShowContactAndAction", propin); | |
var contactId = myapp.GetProfileAttr("IWS_ContactId"); | |
var activityId = myapp.GetProfileAttr("IWS_ActivityId"); | |
var myCollection = createUserData(); | |
if(activityId) | |
myCollection.put("ACTIVITY_ID",activityId); | |
if(contactId) | |
myCollection.put("CONTACT_ID",contactId); | |
if(!myCollection.isEmpty()) | |
SetAttachdataById(message.ConnectionID,myCollection); | |
myCollection = null; | |
contactId = null; | |
activityId = null; | |
propin = null; | |
propout = null; | |
activity = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// SCREEN POP ON CONTACT_ID AND ACTIVITY_ID | |
/** | |
* PopUpContactAndActivity | |
* @param message | |
*/ | |
function PopUpContactAndActivity(message) | |
{ | |
try | |
{ | |
log.info("Executing PopUpContactAndActivity..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var psIn = myapp.NewPropertySet(); | |
var psOut = myapp.NewPropertySet(); | |
psIn.SetProperty("FieldName",""); | |
psIn.SetProperty("FieldValue", ""); | |
psIn.SetProperty("BOName", "Contact"); | |
psIn.SetProperty("BCName", "Contact"); | |
psIn.SetProperty("BCName2", "Action"); | |
psIn.SetProperty("PrimaryRow", message.attachdata.CONTACT_ID); | |
psIn.SetProperty("InteractionID", message.InteractionID); | |
psIn.SetProperty("ViewName","Contact Detail View"); | |
if(message.attachdata.ACTIVITY_ID) | |
{ | |
psIn.SetProperty("PrimaryRow2", message.attachdata.ACTIVITY_ID); | |
} | |
else | |
{ | |
//To avoid a FullTable-Scan | |
psIn.SetProperty("PrimaryRow2", "XXX-XXX"); | |
} | |
psOut = myser.InvokeMethod("ShowTwoEntities", psIn); | |
psIn = null; | |
psOut = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// SCREEN POP ON ACTIVITY_ID | |
/** | |
* PopUpActivity | |
* @param message | |
*/ | |
function PopUpActivity(message) | |
{ | |
try | |
{ | |
log.info("Executing PopUpActivity..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var psIn = myapp.NewPropertySet(); | |
var psOut = myapp.NewPropertySet(); | |
psIn.SetProperty("BOName","Action"); | |
psIn.SetProperty("BCName", "Action"); | |
psIn.SetProperty("FieldName",""); | |
psIn.SetProperty("FieldValue", ""); | |
psIn.SetProperty("PrimaryRow", message.attachdata.ACTIVITY_ID); | |
psIn.SetProperty("ViewName","Activity List View"); | |
psIn.SetProperty("ViewNameNoRecords","Activity List View"); | |
psIn.SetProperty("MultiViewName","Activity List View"); | |
psOut = myser.InvokeMethod("ShowGeneralEntity", psIn); | |
psIn = null; | |
psOut = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// RELEASE EMAIL HANDLING | |
/** | |
* ReleaseEmail | |
* @param message | |
*/ | |
function ReleaseEmail(message) | |
{ | |
try | |
{ | |
log.info("Executing ReleaseEmail..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var psIn = myapp.NewPropertySet(); | |
var psOut = myapp.NewPropertySet(); | |
var psActivity = myapp.NewPropertySet(); | |
if(message.OperationType == "sent") | |
{ | |
log.debug("Email sent"); | |
psActivity.SetProperty("Status", "Sent"); | |
} | |
else if(message.OperationType == "cancelled") | |
{ | |
log.debug("Email cancelled"); | |
psActivity.SetProperty("Status", "Cancelled"); | |
} | |
else if(message.OperationType == "released") | |
{ | |
log.debug("Email released"); | |
psActivity.SetProperty("Status", "Done"); | |
} | |
else if(message.OperationType == "forwarded") | |
{ | |
log.debug("Email forwarded"); | |
psActivity.SetProperty("Status", "Queued"); | |
} | |
else if(message.OperationType == "transferred") | |
{ | |
log.debug("Email transferred"); | |
psActivity.SetProperty("Status", "Queued"); | |
} | |
else | |
{ | |
log.debug("Email done"); | |
psActivity.SetProperty("Status", "Done"); | |
} | |
psIn.AddChild(psActivity); | |
psIn.SetProperty("PrimaryRow", message.attachdata.ACTIVITY_ID); | |
psIn.SetProperty("InteractionID", message.InteractionID); | |
psOut = myser.InvokeMethod("UpdateActivity", psIn); | |
myapp.SetProfileAttr("IWS_ContactId", ""); | |
myapp.SetProfileAttr("IWS_ActivityId", ""); | |
myapp.SetProfileAttr("IWS_AccountId", ""); | |
psIn = null; | |
psOut = null; | |
psActivity = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// UPDATE EMAIL STATUS | |
/** | |
* UpdateEmailStatus | |
* @param message | |
*/ | |
function UpdateEmailStatus(message,status) | |
{ | |
try | |
{ | |
log.info("Executing UpdateEmailStatus..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var psIn = myapp.NewPropertySet(); | |
var psOut = myapp.NewPropertySet(); | |
var psActivity = myapp.NewPropertySet(); | |
psActivity.SetProperty("Status", status); | |
psIn.AddChild(psActivity); | |
psIn.SetProperty("PrimaryRow", message.attachdata.ACTIVITY_ID); | |
psIn.SetProperty("InteractionID", message.InteractionID); | |
psOut = myser.InvokeMethod("UpdateActivity", psIn); | |
psIn = null; | |
psOut = null; | |
psActivity = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
/**************************** | |
SMS MANAGEMENT | |
*****************************/ | |
// SMS SCREEN POP BASED ON FROM FOR CONTACT | |
/** | |
* SMSInboundContactPopUp | |
* @param message | |
*/ | |
function SMSInboundContactPopUp(message) | |
{ | |
try | |
{ | |
log.info("Executing SMSInboundContactPopUp..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var propin = myapp.NewPropertySet(); | |
var propout = myapp.NewPropertySet(); | |
var activity = myapp.NewPropertySet(); | |
activity.SetProperty("Call Id", message.ConnectionID); | |
activity.SetProperty("IWS MediaType", "SMS"); | |
activity.SetProperty("Type", "SMS - Inbound"); | |
activity.SetProperty("Status", "In Progress"); | |
activity.SetProperty("Description", "SMS Inbound from " + message.EntrepriseInteractionCurrent.From + " - ConnectionId: " + message.ConnectionID); | |
activity.SetProperty("Comment", "Subject: " + message.EntrepriseInteractionCurrent.Transcript); | |
propin.AddChild(activity); | |
propin.SetProperty("BONR","Action"); | |
propin.SetProperty("BCNR", "Action"); | |
propin.SetProperty("FieldName","Work Phone #"); | |
propin.SetProperty("FieldValue", message.EntrepriseInteractionCurrent.From );//message.EntrepriseInteractionCurrent.From); //message.ANI); | |
propin.SetProperty("ViewName","Contact Detail View"); | |
propin.SetProperty("ViewNameNoRecords","Activity List View"); | |
propin.SetProperty("MultiViewName","Contact List View"); | |
propout = myser.InvokeMethod("ShowContactAndAction", propin); | |
var contactId = myapp.GetProfileAttr("IWS_ContactId"); | |
var activityId = myapp.GetProfileAttr("IWS_ActivityId"); | |
var myCollection = createUserData(); | |
if(activityId) | |
myCollection.put("ACTIVITY_ID",activityId); | |
if(contactId) | |
myCollection.put("CONTACT_ID",contactId); | |
if(!myCollection.isEmpty()) | |
SetAttachdataById(message.ConnectionID,myCollection); | |
log.debugFormat("Attaccati: ACTIVITY_ID= {0} AND CONTACT_ID={1}",activityId,contactId); | |
myCollection = null; | |
contactId = null; | |
activityId = null; | |
propin = null; | |
propout = null; | |
activity = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// SMS SCREEN POP BASED ON CONTACT_ID | |
/** | |
* SMSInboundContactPopUpContactId | |
* @param message | |
*/ | |
function SMSInboundContactPopUpContactId(message) | |
{ | |
try | |
{ | |
log.info("Executing SMSInboundContactPopUpContactId..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var propin = myapp.NewPropertySet(); | |
var propout = myapp.NewPropertySet(); | |
if(message.attachdata.ACTIVITY_ID) | |
{ | |
propin.SetProperty("BOName","Contact"); | |
propin.SetProperty("BCName", "Contact"); | |
propin.SetProperty("FieldName",""); | |
propin.SetProperty("FieldValue", ""); | |
propin.SetProperty("PrimaryRow", message.attachdata.CONTACT_ID); | |
propin.SetProperty("ViewName","Contact Detail View"); | |
propin.SetProperty("ViewNameNoRecords","Contact List View"); | |
propin.SetProperty("MultiViewName","Contact List View"); | |
propout = myser.InvokeMethod("ShowGeneralEntity", propin); | |
} else | |
{ | |
var activity = myapp.NewPropertySet(); | |
activity.SetProperty("Call Id", message.ConnectionID); | |
activity.SetProperty("IWS MediaType", "SMS"); | |
activity.SetProperty("Type", "SMS - Inbound"); | |
activity.SetProperty("Status", "In Progress"); | |
activity.SetProperty("Description", "SMS Inbound from " + message.EntrepriseInteractionCurrent.From + " - ConnectionId: " + message.ConnectionID); | |
activity.SetProperty("Comment", "Subject: " + message.EntrepriseInteractionCurrent.Transcript); | |
propin.AddChild(activity); | |
propin.SetProperty("FieldName",""); | |
propin.SetProperty("FieldValue", ""); | |
propin.SetProperty("PrimaryRow", message.attachdata.CONTACT_ID); | |
propin.SetProperty("ViewName","Contact Detail View"); | |
propin.SetProperty("ViewNameNoRecords","Contact List View"); | |
propin.SetProperty("MultiViewName","Contact List View"); | |
propout = myser.InvokeMethod("ShowContactAndAction", propin); | |
var activityId = myapp.GetProfileAttr("IWS_ActivityId"); | |
var myCollection = createUserData(); | |
if(activityId) | |
myCollection.put("ACTIVITY_ID",activityId); | |
if(!myCollection.isEmpty()) | |
SetAttachdataById(message.ConnectionID,myCollection); | |
activityId = null; | |
} | |
myCollection = null; | |
propin = null; | |
propout = null; | |
activity = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// SMS SCREEN POP BASED ON TO PROPERTY ON CONTACT | |
// ACTIVITY NOT CREATED | |
/** | |
* SMSOutboundContactPopUpDNIS | |
* @param message | |
*/ | |
function SMSOutboundContactPopUpDNIS(message) | |
{ | |
try | |
{ | |
log.info("Executing SMSOutboundContactPopUpDNIS..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var propin = myapp.NewPropertySet(); | |
var propout = myapp.NewPropertySet(); | |
var activity = myapp.NewPropertySet(); | |
propin.SetProperty("BOName","Contact"); | |
propin.SetProperty("BCName", "Contact"); | |
propin.SetProperty("BONR","Contact"); | |
propin.SetProperty("BCNR", "Contact"); | |
propin.SetProperty("FieldName","Work Phone #"); | |
propin.SetProperty("FieldValue", message.EntrepriseInteractionCurrent.To ); //message.EntrepriseInteractionCurrent.To); | |
propin.SetProperty("ViewName","Contact Detail View"); | |
propin.SetProperty("ViewNameNoRecords","Contact List View"); | |
propin.SetProperty("MultiViewName","Contact List View"); | |
propout = myser.InvokeMethod("ShowGeneralEntity", propin); | |
var recordId = myapp.GetProfileAttr("IWS_RecordId"); | |
var myCollection = createUserData(); | |
if(recordId) | |
myCollection.put("RECORD_ID",recordId); | |
if(!myCollection.isEmpty()) | |
SetAttachdataById(message.ConnectionID,myCollection); | |
myCollection = null; | |
recordId = null; | |
propin = null; | |
propout = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// SMS ACTIVITY CREATION | |
/** | |
* SMSOutboundContactAct | |
* @param message | |
*/ | |
function SMSOutboundContactAct(message) | |
{ | |
try | |
{ | |
log.info("Executing SMSOutboundContactAct..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var propin = myapp.NewPropertySet(); | |
var propout = myapp.NewPropertySet(); | |
propin.SetProperty("Call Id", message.ConnectionID); | |
propin.SetProperty("IWS MediaType", "SMS"); | |
propin.SetProperty("Type", "SMS - Outbound"); | |
propin.SetProperty("Status", "Done"); | |
propin.SetProperty("Description", "SMS Outbound to " + message.EntrepriseInteractionCurrent.To + " - ConnectionId: " + message.ConnectionID); | |
propin.SetProperty("Comment", "Subject: " + message.EntrepriseInteractionCurrent.Transcript); | |
propin.SetProperty("Contact Id",message.attachdata.RECORD_ID); | |
propout = myser.InvokeMethod("ActivityCreationContact", propin); | |
var activityId = myapp.GetProfileAttr("IWS_ActivityId"); | |
var myCollection = createUserData(); | |
if(activityId) | |
myCollection.put("ACTIVITY_ID",activityId); | |
if(!myCollection.isEmpty()) | |
SetAttachdataById(message.ConnectionID,myCollection); | |
myCollection = null; | |
activityId = null; | |
propin = null; | |
propout = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
// SMS ACTIVITY CREATION FOR THE SENT MESSAGE (FROM THE INBOUND INTERACTION WINDOW) | |
/** | |
* SMSSendContactAct | |
* @param message | |
*/ | |
function SMSSendContactAct(message) | |
{ | |
try | |
{ | |
log.info("Executing SMSSendContactAct..."); | |
var myapp = top.theApplication(); | |
var myser = myapp.GetService("IWS Connector"); | |
var propin = myapp.NewPropertySet(); | |
var propout = myapp.NewPropertySet(); | |
propin.SetProperty("Call Id", message.ConnectionID); | |
propin.SetProperty("IWS MediaType", "SMS"); | |
propin.SetProperty("Type", "SMS - Outbound"); | |
propin.SetProperty("Status", "Done"); | |
propin.SetProperty("Description", "SMS Outbound Replay to " + message.attachdata.PhoneNumber + " - ConnectionId: " + message.ConnectionID); | |
propin.SetProperty("Comment", "Subject: " + message.SmsMessage); | |
propin.SetProperty("Contact Id",message.attachdata.CONTACT_ID); | |
propout = myser.InvokeMethod("ActivityCreationContact", propin); | |
propin = null; | |
propout = null; | |
myser = null; | |
myapp = null; | |
} catch(e) | |
{ | |
log.error("Exception " + e.message); | |
} | |
} | |
//alert("IWSUTILSWELLFORMED"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment