- Thank you received: 9
Welcome to the fracta.net forum!
Share your coding ideas or ask questions.
Share your coding ideas or ask questions.
Question VBA initialize Skills
- DamianVBA
- Topic Author
- Visitor
7 years 7 months ago #639
by DamianVBA
VBA initialize Skills was created by DamianVBA
Hi there admin!
I've been surfing your forum for 3 hours now and i got something from here and there... What I need is an excel Worksheet which lets me put all skills and prioritys for all agents to default once i click the button.
http://postimg.org/image/70ujyt87h/
The worksheet should be something like this (still working on it) but i can't get the code to work. I'm using your code to run it from a running server (not openning a new one) and some code i found from another user asking:
The code seems to work, but it doesn't do anything. I want the array to be dynamic because not always need to leave default the same amount of agents... Can you please give me some help?
Thanks in advance!
I've been surfing your forum for 3 hours now and i got something from here and there... What I need is an excel Worksheet which lets me put all skills and prioritys for all agents to default once i click the button.
http://postimg.org/image/70ujyt87h/
The worksheet should be something like this (still working on it) but i can't get the code to work. I'm using your code to run it from a running server (not openning a new one) and some code i found from another user asking:
Code:
Dim cvsApp As New ACSUP.cvsApplication
Dim cvsConn As New ACSCN.cvsConnection
Dim cvsSrv As New ACSUPSRV.cvsServer
Dim Rep As New ACSREP.cvsReport
Dim Info As Object, Log As Object, b As Object
Dim logged As Boolean
Public Sub SkillAgentes()
Application.ScreenUpdating = False
Set cvsSrv = cvsApp.Servers(1)
Dim Lastrow As Long
Dim LastCol As Long
Dim wsMain As Worksheet
Set wsMain = Sheets("InicialViesgo")
Dim l As Integer
Dim c As Integer
Dim p As Integer
Dim S As Integer
Dim t As Integer
Dim Skill As String
Dim Prtr As Integer
Dim SetArr() As Variant
Set AgMngObj = cvsSrv.AgentMgmt
S = 1
Lastrow = wsMain.Range("c" & wsMain.Rows.Count).End(xlUp).Row
For l = 2 To Lastrow
LastCol = wsMain.Range("c" & l).End(xlToRight).Column
For c = 5 To LastCol Step 2
On Error Resume Next
Skill = wsMain.Cells(l, c).Value
Prtr = wsMain.Cells(l, c + 1).Value
ReDim Preserve SetArr(Lastrow - 1, 4)
If Skill = 0 Then
Else
SetArr(S, 1) = Skill
SetArr(S, 2) = Prtr
SetArr(S, 3) = 0
SetArr(S, 4) = 0
S = S + 1
End If
Next c
AgMngObj.AcdStartUp -1, "", cvsSrv.ServerKey, -1
AgMngObj.OleAgentSetSkill_R16_1 2, c - 2, 1, 0, 0, 0, c - 3, SetArr, ""
S = 1
Next l
MsgBox "Skill Change completed."
'===================com======================================
On Error GoTo 0
Set AgMngObj = Nothing
cvsSrv.ActiveTasks.Refresh
cvsApp.Servers.Remove cvsSrv.ServerKey
cvsSrv.Connected = False
cvsConn.logout
cvsConn.Disconnect
cvsSrv.ActiveTasks.Refresh
Set cvsConn = Nothing
Set cvsSrv = Nothing
Set cvsApp = Nothing
Set op = Nothing
Set sh = Nothing
End Sub
The code seems to work, but it doesn't do anything. I want the array to be dynamic because not always need to leave default the same amount of agents... Can you please give me some help?
Thanks in advance!
Please Log in or Create an account to join the conversation.
7 years 7 months ago - 7 years 7 months ago #640
by roller
Replied by roller on topic VBA initialize Skills
Looking quickly at it the line
ReDim Preserve SetArr(Lastrow - 1, 4) does not have to be within the column loop, shouldn't that be set near the top once only once you determine the number or rows?
But the above is not the issue, the function has the following inputs: OleAgentSetSkill(iAcd As Integer, sAgentID As String, iAgentPref As Integer, iDirectSkill As Integer, iDirFirst As Integer, iSrvObj As Integer, iNumskills As Integer, cSkillResult, sWarn As String) As Boolean
The second input should be the agent ID but you have C-2 in there which is the column number.
And is your ACD number 2?
You should try to read this post:
fracta.net/fracta/index.php/forum/2-exce...aya-cms?limitstart=0
Try first to follow the post and set one agent manually to test if it works and then build your dynamic array after. It's always best to start simple and test, make sure it works and add new code. Don't try to build everything from the beginning. That way errors are easier to find.
You can replace the Server section to use the running server instead of creating a new one but remember sometimes you might have orphaned dead server objects and the running one could be Set cvsSrv = cvsApp.Servers(2) or Set cvsSrv = cvsApp.Servers(3) it doesn't have to be always Set cvsSrv = cvsApp.Servers(1) (in most cases it is though).
ReDim Preserve SetArr(Lastrow - 1, 4) does not have to be within the column loop, shouldn't that be set near the top once only once you determine the number or rows?
But the above is not the issue, the function has the following inputs: OleAgentSetSkill(iAcd As Integer, sAgentID As String, iAgentPref As Integer, iDirectSkill As Integer, iDirFirst As Integer, iSrvObj As Integer, iNumskills As Integer, cSkillResult, sWarn As String) As Boolean
The second input should be the agent ID but you have C-2 in there which is the column number.
And is your ACD number 2?
You should try to read this post:
fracta.net/fracta/index.php/forum/2-exce...aya-cms?limitstart=0
Try first to follow the post and set one agent manually to test if it works and then build your dynamic array after. It's always best to start simple and test, make sure it works and add new code. Don't try to build everything from the beginning. That way errors are easier to find.
You can replace the Server section to use the running server instead of creating a new one but remember sometimes you might have orphaned dead server objects and the running one could be Set cvsSrv = cvsApp.Servers(2) or Set cvsSrv = cvsApp.Servers(3) it doesn't have to be always Set cvsSrv = cvsApp.Servers(1) (in most cases it is though).
Last edit: 7 years 7 months ago by roller.
The following user(s) said Thank You: DamianVBA
Please Log in or Create an account to join the conversation.
- DamianVBA
- Topic Author
- Visitor
7 years 7 months ago #641
by DamianVBA
Replied by DamianVBA on topic VBA initialize Skills
Hi there again!
Sorry for the late, but until now i couldn't give it a try.
Yes, we've got 2 acd, 1 and 2, in this case im trying it for ACD 2, will make it a variable later on but now what happens with this new code:
The code looks like it works, but then a message warning from avaya pops telling me that i don't have the permission to write on the selected skill, don't know why because if i try it manually i can change skills without problems.
Another thing is that when the code ends, avaya stops working and I need to close both Excel and Avaya.
Any clues? Thanks for your help!
Sorry for the late, but until now i couldn't give it a try.
Yes, we've got 2 acd, 1 and 2, in this case im trying it for ACD 2, will make it a variable later on but now what happens with this new code:
Code:
Public Sub SkillAgentes()
Application.ScreenUpdating = False
Set cvsSrv = cvsApp.Servers(1)
Dim Lastrow As Long
Dim LastCol As Long
Dim wsMain As Worksheet
Set wsMain = Sheets("InicialViesgo")
Dim l As Integer
Dim c As Integer
Dim p As Integer
Dim S As Integer
Dim t As Integer
Dim Skill As String
Dim Prtr As Integer
Dim SetArr() As Variant
Set AgMngObj = cvsSrv.AgentMgmt
S = 1
Lastrow = wsMain.Range("D" & wsMain.Rows.Count).End(xlUp).Row
ReDim SetArr(Lastrow - 1, 4)
For i = 2 To Lastrow
LastCol = wsMain.Cells(i, 4).End(xlToRight).Column
For c = 5 To LastCol Step 2
On Error Resume Next
Skill = wsMain.Cells(i, c).Value
Prtr = wsMain.Cells(i, c + 1).Value
If Skill = 0 Then
Else
SetArr(S, 1) = Skill
SetArr(S, 2) = Prtr
SetArr(S, 3) = 0
SetArr(S, 4) = 0
S = S + 1
End If
Next c
AgMngObj.AcdStartUp -1, "", cvsSrv.ServerKey, -1
AgMngObj.OleAgentSetSkill_R16_1 2, "70073", 1, 0, 0, 0, 1, SetArr, ""
S = 1
Next i
MsgBox "Skill Change completed."
Set AgMngObj = Nothing
cvsSrv.ActiveTasks.Refresh
cvsApp.Servers.Remove cvsSrv.ServerKey
cvsSrv.Connected = False
cvsConn.logout
cvsConn.Disconnect
cvsSrv.ActiveTasks.Refresh
Set cvsConn = Nothing
Set cvsSrv = Nothing
Set cvsApp = Nothing
Set op = Nothing
Set sh = Nothing
End Sub
The code looks like it works, but then a message warning from avaya pops telling me that i don't have the permission to write on the selected skill, don't know why because if i try it manually i can change skills without problems.
Another thing is that when the code ends, avaya stops working and I need to close both Excel and Avaya.
Any clues? Thanks for your help!
Please Log in or Create an account to join the conversation.
- DamianVBA
- Topic Author
- Visitor
7 years 7 months ago #642
by DamianVBA
Replied by DamianVBA on topic VBA initialize Skills
Trying out the other way:
It won't let me log in to the server... i tried it before when i couldn't i looked for the "running server method".
Code:
Sub ChangeSkills()
Dim agents As String
Dim cvsApp As Object
Dim cvsConn As Object
Dim cvsSrv As Object
Dim SetArr() As Variant
Dim sWarn As String
Dim Skills() As Variant
Dim UserName As String: UserName = "username"
Dim Password As String: Password = "password"
ReDim SetArr(7, 3) ''Create Skill Array for CMS, 7 skills in total here to do
SetArr(1, 1) = 1735 ' skill number 6
SetArr(1, 2) = 1 ' priority 1 or 2
SetArr(1, 3) = 0
SetArr(2, 1) = 1849 'skill number 14 etc...
SetArr(2, 2) = 1
SetArr(2, 3) = 0
SetArr(3, 1) = 1713
SetArr(3, 2) = 1
SetArr(3, 3) = 0
SetArr(4, 1) = 1777
SetArr(4, 2) = 1
SetArr(4, 3) = 0
SetArr(5, 1) = 1852
SetArr(5, 2) = 2
SetArr(5, 3) = 0
SetArr(6, 1) = 1760
SetArr(6, 2) = 1
SetArr(6, 3) = 0
SetArr(7, 1) = 1834
SetArr(7, 2) = 1
SetArr(7, 3) = 0
Set cvsApp = CreateObject("ACSUP.cvsApplication")
Set cvsConn = CreateObject("ACSCN.cvsConnection")
Set cvsSrv = CreateObject("ACSUPSRV.cvsServer")
sWarn = ""
Dim CMS As String: CMS = "serverip"
If cvsApp.CreateServer(UserName, "", "", "CMS", False, "ENU", cvsSrv, cvsConn) Then
If cvsConn.Login(UserName, Password, "CMS", "ENU") Then
On Error Resume Next
Set AgMngObj = cvsSrv.AgentMgmt
'Change Skills
agents = "70073" ' for these three agents numbers, you can add more
AgMngObj.AcdStartUp -1, "", cvsSrv.ServerKey, -1
AgMngObj.OleAgentSetSkill 2, "" & agents & "", 1, 1735, 0, 0, 1, SetArr, sWarn ' note the 7 for 7 skills in SetArr and the 6 is the base skill number yours might be 1, you can find this by referencing the avaya script in notepad
Set AgMngObj = Nothing
Else
MsgBox "Unable to Logon. Please Try Again."
End If
End If
Set cvsApp = Nothing
Set cvsConn = Nothing
Set cvsSrv = Nothing
End Sub
It won't let me log in to the server... i tried it before when i couldn't i looked for the "running server method".
Please Log in or Create an account to join the conversation.
- DamianVBA
- Topic Author
- Visitor
7 years 7 months ago #643
by DamianVBA
Replied by DamianVBA on topic VBA initialize Skills
Ok, one more time, i've been touching everything on avaya, so i find out where this code comes for avaya, turns out that i don't have the permissions on my agents and skills in that section of avaya, so i will have to ask for them... But the way you do it, starting a new server still doesn't work, vba opens de server but can't log in... i have my user and password correctly spelled, got the language (ESO in my case) and everything else, but it just won't log in
Please Log in or Create an account to join the conversation.
7 years 7 months ago #644
by roller
Replied by roller on topic VBA initialize Skills
It is not working for you because you are passing "CMS" an actual string of value CMS so unless if your CMS DNS name is CMS it won't work. Instead pass the variable CMS which you assigned to your IP- lime this without the ""
cvsConn.Login(UserName, Password, CMS, "ENU"
You can also pass the password twice like the below:
If cvsApp.CreateServer("login", "password", "", "serverCMS", False, "ENU", cvsSrv, cvsConn) Then
If cvsConn.Login("login", "password", "serverCMS", "ENU") Then
On Error Resume Next
Set AgMngObj = cvsSrv.AgentMgmt
cvsConn.Login(UserName, Password, CMS, "ENU"
You can also pass the password twice like the below:
If cvsApp.CreateServer("login", "password", "", "serverCMS", False, "ENU", cvsSrv, cvsConn) Then
If cvsConn.Login("login", "password", "serverCMS", "ENU") Then
On Error Resume Next
Set AgMngObj = cvsSrv.AgentMgmt
The following user(s) said Thank You: DamianVBA
Please Log in or Create an account to join the conversation.
Time to create page: 1.670 seconds