cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1447
Views
0
Helpful
3
Replies

CCX Script - Setting Document Variable Returns NULL?

Matthew Martin
Level 5
Level 5

Hello All,

UCCX Version: 8.5.1.11004-25

So I have a Script for a CSQ/Application (*called "App-1") in which I am running a "Trigger Application" step in. That Trigger Application Step calls another Application, let's call it "App-2".

From inside App-1, I used a "Set Session Info" Step to set a context String variable called "AppName". Then, inside App-2 I capture "AppName" by running the "Get Session Info" Step. All these parts seem to work just fine.

The problem is, a few steps later I attempt to Set a Document variable, but after stepping through that "Set" line, I can see it sets the Document variable to "null", and I am not sure what I am doing wrong. I thought maybe it had something to do with the Language, so I used a "Get Trigger Info" Step and assigned a Language variable to that step's Language attribute, which returns the correct language. But, I still get "null" when setting the Document variable.

App-1:

...
.....
/* Assign the Current Session to the variable "session" */
session = Get Contact Info(--Triggering Contact--, Session)
/* Assign the Context Var "AppName" in this Set Session Info Step */
Set Session Info(session)
Trigger Application("App-2", --Triggering Language--, synchronous)
.....
...


App-2:

Start
/* Get the Trigger Language */
Get Trigger Info()
/* Capture the Context Var of AppName */
App_CheckName = Get Session Info(session, "AppName")
/* Verify "AppName" contains data */
if (App_CheckName != null && App_CheckName != "")
TRUE
/* Set the String "Application" to the name of the App who Triggered this */
---Set (String) Application = App_CheckName
/* Concatenate a String together that equals the name of the XML Document */
---Set (String) tmp_DocName = "Holidays_" + Application + ".xml"
/* Now, Set the Document variable to the correct XML Document for the Triggering App name, *i.e. "App-1" in this case */
---Set (Document) XMLHolidaysDocument = DOC[tmp_DocName]
FALSE
.....do other stuff....

The Bold underlined line above is what is returning null for the Document variable assignment Step...

No matter how I concatenate the string together, the XMLHolidaysDocument Document Variable is always equal to "null" after evaluating the Set line for that var... I've even tried setting a full path like, "/en_US/Holidays_App-1.xml", but still results as "null"...

Anyone have any idea what I'm doing wrong here? Any help would be greatly appreciated!

Thanks in Advance,
Matt

3 Replies 3

Aaron Harrison
VIP Alumni
VIP Alumni

Hi Matt

Not looking at the logs ;-)

Best thing to do is tail the MIVR logs, as you step through the script. When you step over the 'set' step that returns null, you should see a block of 'EXCEPTION' text in the MIVR log.

That will usually tell you what went wrong and with file-related stuff usually will list the full path that UCCX is trying.

If the logs don't make sense to you post them up.

Aaron

Aaron Please remember to rate helpful posts to identify useful responses, and mark 'Answered' if appropriate!

Hey Aaron, thanks for the reply!

Ok cool, thanks, I'll give that a shot and post back with what I find.

Thanks Again,

Matt

Hey Aaron,

Below is a part of the MIVR log. Not really sure what to make of it...

All the lines below are all consecutive lines in the MIVR log. I can see this is the step where it "Sets" the "XMLHolidaysDocument" variable of type "Document"... If you look where it lists all the variables, their type, and their value, you can see that "XMLHolidaysDocument" Document variable is equal to "EmptyDocument[]". Then, the next section below (*which I am assuming is after it executes the 'set' line) shows that variable again, this time it's equal to "null"... But, I didn't really see any Exception related to that or anything along those lines...

I'll also attach a more complete txt file containing the MIVR log data. Hopefully you'll be able to spot the Exception since I'm not really seeing it in there for that specific Step of the Script...

Tail from MIVR Log:

State: STARTED
Application: App[name=App-2,type=Cisco Script Application,id=11,desc=App-2,enabled=true,max=50,valid=true,cfg=[ApplicationConfig[schema=ApplicationConfig,time=2015-12-15 16:49:41.0,recordId=215,desc=App-2,name=App-2,type=Cisco Script Application,id=11,enabled=true,sessions=50,script=SCRIPT[App-2_App2.aef],defaultScript=,vars=null,defaultVars=null]]]
Trigger: TriggerApplicationStep.Trigger[time=1450287294019,locale=en_US,cfg=null,parameters={session=Session[id=001-0x5879c4dc27,parent=null,active=true,state=SESSION_IN_USE,time=1450287276995]}]
   An object of com.cisco.wfframework.engine.core.WFEngineWorkflowDebugTask
   ID: 36000100111
   Start time (ms): 1450287294019
   Source ID:
   Destination ID:
   Media Instance ID: null
   Session handled: false
   Context:
   An object of com.cisco.wfframework.obj.WFWorkflowContext
   {
     {isHoliday, java.lang.Boolean, false}
     {currentYear, java.lang.String, 2015}
     {currentDate, java.lang.String, 12/16/2015}
     {currentMonth, java.lang.String, 12}
     {currentDay, java.lang.String, 16}
     {XMLHolidays, com.cisco.doc.Document, EmptyDocument[]}
     {XMLHolidaysDocument, com.cisco.doc.Document, EmptyDocument[]}
     {holidayID, java.lang.Integer, 1}
     {holidayRetrieved, java.lang.String, }
     {currentHour, java.lang.String, 12}
     {currentMinute, java.lang.String, 35}
     {isFullHoliday, java.lang.String, }
     {startTime, java.lang.String, }
     {endTime, java.lang.String, }
     {startHourInt, java.lang.Integer, 0}
     {startMinuteInt, java.lang.Integer, 0}
     {endHourInt, java.lang.Integer, 0}
     {endMinuteInt, java.lang.Integer, 0}
     {elapsedMinutesForStart, java.lang.Integer, 0}
     {elapsedMinutesForEnd, java.lang.Integer, 0}
     {elapsedMinutes, java.lang.Integer, 0}
     {Application, java.lang.String, App-1}
     {App_CheckName, java.lang.String, App-1}
     {HELLO, java.lang.String, Hello From App-2}
     {session, com.cisco.session.Session, Session[id=001-0x5879c4dc27,parent=null,active=true,state=SESSION_IN_USE,time=1450287276995]}
     {tmp_DocName, java.lang.String, /en_US/Holidays_App-1.xml}
     {GTI_Language, java.util.Locale, en_US}
     {GTI_ApplicationName, java.lang.String, App-2}
   }
   Private Context:
   An object of com.cisco.wfframework.obj.WFWorkflowContext
   {
     {C6E09414-FE87-11d2-A3CA-00108300BD05_GED125ExpCallVariables, java.util.Hashtable, {}}
   }
   Number of executed steps: 16
   Current step: Set XMLHolidaysDocument = DOC[tmp_DocName]
<<<<<

157914289: Dec 16 12:39:05.221 EST %MIVR-ENG-7-UNK:Execute step of Task 36000100111 : Set XMLHolidaysDocument = DOC[tmp_DocName]
157914290: Dec 16 12:39:05.221 EST %MIVR-ENG-7-UNK:>>>>> After stepping
An object of com.cisco.app.impl.WFWorkflowAppDebugTaskWrapper
State: STARTED
Application: App[name=App-2,type=Cisco Script Application,id=11,desc=App-2,enabled=true,max=50,valid=true,cfg=[ApplicationConfig[schema=ApplicationConfig,time=2015-12-15 16:49:41.0,recordId=215,desc=App-2,name=App-2,type=Cisco Script Application,id=11,enabled=true,sessions=50,script=SCRIPT[App-2_App2.aef],defaultScript=,vars=null,defaultVars=null]]]
Trigger: TriggerApplicationStep.Trigger[time=1450287294019,locale=en_US,cfg=null,parameters={session=Session[id=001-0x5879c4dc27,parent=null,active=true,state=SESSION_IN_USE,time=1450287276995]}]
   An object of com.cisco.wfframework.engine.core.WFEngineWorkflowDebugTask
   ID: 36000100111
   Start time (ms): 1450287294019
   Source ID:
   Destination ID:
   Media Instance ID: null
   Session handled: false
   Context:
   An object of com.cisco.wfframework.obj.WFWorkflowContext
   {
     {isHoliday, java.lang.Boolean, false}
     {currentYear, java.lang.String, 2015}
     {currentDate, java.lang.String, 12/16/2015}
     {currentMonth, java.lang.String, 12}
     {currentDay, java.lang.String, 16}
     {XMLHolidays, com.cisco.doc.Document, EmptyDocument[]}
     {XMLHolidaysDocument, com.cisco.doc.Document, null}
     {holidayID, java.lang.Integer, 1}
     {holidayRetrieved, java.lang.String, }
     {currentHour, java.lang.String, 12}
     {currentMinute, java.lang.String, 35}
     {isFullHoliday, java.lang.String, }
     {startTime, java.lang.String, }
     {endTime, java.lang.String, }
     {startHourInt, java.lang.Integer, 0}
     {startMinuteInt, java.lang.Integer, 0}
     {endHourInt, java.lang.Integer, 0}
     {endMinuteInt, java.lang.Integer, 0}
     {elapsedMinutesForStart, java.lang.Integer, 0}
     {elapsedMinutesForEnd, java.lang.Integer, 0}
     {elapsedMinutes, java.lang.Integer, 0}
     {Application, java.lang.String, App-1}
     {App_CheckName, java.lang.String, App-1}
     {HELLO, java.lang.String, Hello From App-2}
     {session, com.cisco.session.Session, Session[id=001-0x5879c4dc27,parent=null,active=true,state=SESSION_IN_USE,time=1450287276995]}
     {tmp_DocName, java.lang.String, /en_US/Holidays_App-1.xml}
     {GTI_Language, java.util.Locale, en_US}
     {GTI_ApplicationName, java.lang.String, App-2}
   }
   Private Context:
   An object of com.cisco.wfframework.obj.WFWorkflowContext
   {
     {C6E09414-FE87-11d2-A3CA-00108300BD05_GED125ExpCallVariables, java.util.Hashtable, {}}
   }
   Number of executed steps: 17
   Current step: Set XMLHolidaysDocument = DOC[tmp_DocName]
<<<<<


This "App-2" Application, is a new Application that I just created using an existing Script (*called BaseLineHoliday.aef). What I did was, I copied that original script to a new one and I renamed it, and uploaded it to UCCX Script Management page. Then, I used my new Call Queue application (*App-1) and ran a "Trigger Application" step, passing in data to App-2 and receiving data back from App-2.

But, before I created the new Application using the modified version of the BaseLineHoliday.aef script, that original script was called by our other Call Queue Applications by using the Call Subflow Step. And since I am having this issue with assigning the Document variable, I am wondering if this was ever working... But, I don't know since you are unable to do a reactive debug of a Call Subflow.

I just thought I should mention that just in case a "Trigger Application" and a "Call Subflow" are supposed to differ in how they access files on the server... Does that make sense?

EDIT: FYI, I just uploaded a new Holidays XML Document for that specific application to UCCX and made today a holiday, and then I switched the Script for App-1 back to the original script that does a "Call Subflow" instead of the "Trigger Application" Step and it returned a "true" for the Boolean variable telling you if today is a holiday or not... So it does seem to work just fine when calling from a Call Subflow Step, but not when calling from a Trigger Application Step... Is there much of a difference in how the called script gets executed between those 2 Step methods..?


Thanks Again,
Matt