cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
522
Views
5
Helpful
3
Replies

Subflows

aaronbanks
Level 1
Level 1

I have 2 scripts - a main script and a holiday script.  I want to use a subflow to call the holiday script.  How it should work is the holiday script should be called from the main script to check an see if 1)it is a holiday 2) day of week 3)time of day...if all checks out then the call is routed direct to an agent.  I don't understand what is needed (if anything) for input mappings or output mappings or if the script accommodates that.

Thanks!

3 Replies 3

Anthony Holloway
Cisco Employee
Cisco Employee

A subflow, in my opinion, should be treated like a black box, which recieves input (optionally), and then produces output (optionally), and the calling script should not know, nor care, what's happening inside the box.

For your example of holiday checking, there could be two inputs: timezone and list of holidays.  This way, each  calling script, could be servicing different business units in different timezones who observe different holidays.  However, the black box magic, will still work on this input, and produce a single output: a true or false boolean on whether or not the current date/time in the specified timezone matches one of the holiday dates provided.

For your example of business hours (day of week and time of day), the input could be a timezone and schedule name/ID that this calling script "subscribes" to, and then the subflow produces a single output: a true or false boolean on whether or not the current day and time is within business hours.

I do not like to create subflows which steer the caller down paths, I.e., forks in the road.  This leads to too much nesting and you lose the ability to reactive debug a call from start to finish.  Additionally, I like to create subflows which have no dependency on an active Contact, and thus can be tested with Active Debugging and not Reactive Debugging.

If you have specific questions, please ask.  I love talking about this stuff.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.

Sure I have a TON of questions.  My mind makes it simple before a call is delivered to an agent, we have to determine if it's a holiday, a saturday or sunday or between 5 pm and 6 am.  If any of those conditions exist, then an announcement is played.  Would it be better to accomplish this with a time of day check within the main script?  There should be no caller input at this point.

Thanks Anthony...if you have time, I have questions...and I'm not a good programmer.

I have plenty of time.

I would not do day of week/time of day in a subflow.  The subflow would net you a benefit if multiple scripts all share the same schedule, but that's more for optimization, and you don't want to optimize too soo, or it can affect your design.

http://en.wikipedia.org/wiki/Program_optimization#When_to_optimize

This is how I code: I write a single script to do everything I need.  I test.  I optimize.  I test again.  Repeat optimize/test cycle.  When another piece of code needs the same logic as one that I have already written, as is the case with a business schedule, I then break the code out of the existing script, place into a subflow, test again, and then create the new script, leveraging the subflow.  This way I'm not getting carried away with subflows and modularity when it's completely unnecessary.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.