new ArchFlowCommonModule(coreCommonModuleCallFlowViewModel)
Parameters:
| Name | Type | Description |
|---|---|---|
coreCommonModuleCallFlowViewModel |
Object | ( Internal ) an Architect core common module view model. |
Extends
Members
-
static, readonly displayTypeName :string
-
Returns the display type name string 'ArchFlowCommonModule'.
-
readonly dataTypes :Object
-
Accessing this property returns an object with properties whose keys are data type names and values are
ArchDataTypeinstances.- Overrides:
-
description :string
-
The description of the flow
- Overrides:
-
readonly division :ArchDivision
-
Returns the division associated with this flow. This method first calls
ArchOrganizationInfo#areDivisionsAvailableto ensure that divisions are available. If not available, nothing is returned.- Overrides:
-
readonly flowType :string
-
The type of the flow. The string values in
ArchEnums#FLOW_TYPESlists valid flow type values.- Overrides:
-
readonly id :string
-
The identifier string for this object.
- Overrides:
-
readonly idMayBeBlank :string
-
Returns whether or not the id property may be blank or undefined for this object. For example, the returned settings from
ArchMenu#settingsMenuwill have a blank identifier along with the settings returned fromArchMenu#settingsSpeechRec. Note that this is an extremely rare case.- Overrides:
- See:
-
readonly isArchBaseCoreObject :boolean
-
Returns true indicating that this is an ArchBaseCoreObject instance.
- Overrides:
-
isArchFlowCommonModule :boolean
-
Returns true indicating that this is an ArchFlowCommonModule instance.
-
readonly isCreated :boolean
-
Returns whether or not the flow is created in Genesys Cloud.
- Overrides:
-
readonly isReadOnly :boolean
-
Returns whether or not the flow is read-only. Flows that have been created locally in scripting but not saved, checked in or published will report that they are not read-only.
- Overrides:
-
readonly isSecure :boolean
-
Returns whether or not the flow is secure. That means it contains something that is secure like a secure variable or secure action.
- Overrides:
-
readonly isVariableContainer :boolean
-
Returns true indicating the flow acts as a variable container which means you can add variables to it.
- Overrides:
-
readonly languageSettings :ArchSettingsSupportedLanguagesFlow
-
The language settings for the flow. This property is now deprecated. Please replace calls to this property with
ArchBaseFlow#settingsSupportedLanguagesinstead.- Overrides:
- Deprecated:
- Yes
-
readonly logStr :string
-
Returns a string suitable for logging that describes the flow
- Overrides:
-
readonly logStrTypeOnly :string
-
This is a string suitable for logging information about this object where it's just the object's type. This is normally used when logging errors that occur in constructor parameter checking because the scripting object isn't set up and the normal logging str contents wouldn't be set up.
- Overrides:
-
name :string
-
The name of the flow
- Overrides:
-
readonly settingsActionDefaults :ArchSettingsActionDefaults
-
Returns the action default settings for the flow.
- Overrides:
-
readonly settingsCommonModule :ArchSettingsCommonModuleFlow
-
The common module settings for the flow where you can set the compatible flow types.
-
readonly settingsErrorHandling :ArchSettingsEventErrorFlow
-
Returns the error handling settings for the flow.
- Overrides:
-
readonly settingsPrompts :ArchSettingsPromptsFlow
-
The prompt settings for the flow. If no destination flow types configured on this Common Module flow support prompt settings, nothing is returned.
-
readonly settingsSupportedLanguages :ArchSettingsSupportedLanguagesFlow
-
The supported language settings for the flow. This method will throw if the flow doesn't support languages. You can check
ArchBaseFlow#supportsLanguagesprior to calling this method to see if a flow supports languages or not.- Overrides:
-
readonly startUpObject :ArchTask
-
Returns the starting task for this common module flow.
-
readonly supportsAudio :boolean
-
Returns whether or not this flow supports audio channel.
- Overrides:
-
readonly supportsDefaultLanguage :boolean
-
Returns whether or not this flow supports setting a supported language as the default.
- Overrides:
-
readonly supportsErrorHandling :boolean
-
Returns whether or not this flow supports error handling.
- Overrides:
-
readonly supportsLanguages :boolean
-
Returns whether or not this flow supports languages. If false, that means you have to configure the flow when creating it to use English United States. Note: At this time this functionality is available while we're determining the needs of workflow and inbound email flow types. This property may go away in a future release of Architect Scripting.
- Overrides:
-
readonly url :string
-
Returns a URL for this flow. If the flow has not been created or there is no startup object set on the flow, the returned URL will be blank.
- Overrides:
- See:
-
readonly variables :Array.<ArchBaseVariable>
-
Returns an array of variables defined at the flow scope for this flow.
- Overrides:
Methods
-
addFlowSupportedLanguage(archLanguage, setAsDefaultLanguageopt) → {ArchSettingsSupportedLanguage}
-
Helper method that accesses the flow's
settingsSupportedLanguagesand then calls theaddSupportedLanguagefunction on the returnedArchSettingsSupportedLanguagesFlowvalue.Parameters:
Name Type Attributes Description archLanguageArchLanguage the language to add to supported languages on the flow. Note that any language used as a supported language must have at least one region sub-tag.
setAsDefaultLanguageboolean <optional>
if true, the language will be set as the default language on the flow.
Returns:
ArchSettingsSupportedLanguage- Overrides:
-
addVariable(name, type, descriptionopt) → {ArchBaseVariable}
-
This adds a new variable to the flow.
Parameters:
Name Type Attributes Description namestring the name of the variable to add. Remember that variable names must start with a letter and can then be followed by one or more letters, numbers or underscore characters to be valid. Submitting the variable scope on the name is optional. If specified, it must be 'Flow.' in order to be valid since you're adding the variable to a flow.
typeArchDataType the data type for the new variable. Remember that type must be supported in the flow type for which you're looking to add the variable. If you are not sure if a type is creatable, see the
ArchDataType#isScriptCreatableForFlowTypeorArchDataType#isScriptCreatableForFlowmethod.descriptionstring <optional>
the description for the new variable.
Returns:
ArchBaseVariable- Overrides:
-
canAddSupportedLanguage() → {boolean}
-
Checks flow to see if a language can be added in its current state. Some flows may have restrictions if any or more than one can be added.
Returns:
boolean- Overrides:
-
checkInAsync(ensureSearchableopt) → {Promise}
-
Checks in and unlocks the flow for the current user, does a save first Assumes the flow has been created, throws if not
Parameters:
Name Type Attributes Description ensureSearchableboolean <optional>
whether or not to poll after successful checkin to ensure that the flow is available for flow search operations such as
ArchFactoryFlows#getFlowInfoByFlowNameAsyncorArchFactoryFlows#getFlowInfoByFlowIdAsyncReturns:
Promise -- On your promise's then handler, the first parameter passed to the then function will be this flow instance.
- Overrides:
-
checkoutAsync(forceUnlockopt, callbackFunctionopt) → {Promise}
-
Checkout this flow. This function returns an ArchInfo instance for it to the supplied callback function.
Parameters:
Name Type Attributes Description forceUnlockboolean <optional>
if true, will force an unlock of the flow.
callbackFunctioncallbackVoid <optional>
a callback function to call if the flow was checked out.
Returns:
Promise -- while this method returns a promise, you should use the callback function to perform any processing once the flow is checked out.
- Overrides:
-
createAsync() → {Promise}
-
Creates a new flow on the server and saves its configuration
Returns:
Promise -- On your promise's then handler, the first parameter passed to the then function will be this flow instance.
- Overrides:
-
exportToDirAsync(destinationDiropt, callbackFunctionopt, flowFormatopt, fileNameopt) → {Promise}
-
Exports the current flow to a file in the specified directory. This destination directory must exist for the export to succeed. Note that this uses the file system and should not be used when running in a browser.
Parameters:
Name Type Attributes Default Description destinationDirstring <optional>
the directory where the flow export should be saved.
callbackFunctioncallbackExportFullPath <optional>
the function to call back and pass in the full path where the flow export was saved.
flowFormatstring <optional>
ArchEnums.FLOW_FORMAT_TYPES.architect the desired flow format to use for the export. See
ArchEnums#FLOW_FORMAT_TYPESfor allowable export formats. If no format is used, it will default to the Architect format.fileNamestring <optional>
the file name to use for the exported flow. If a file extension is not added to the file name, it will use the default file extension for the desired export type for the desired export format and flow that you are exporting. If the format is YAML, the extension is always '.yaml' regardless of flow type. However, if it is the Architect format, the extension is unique per flow-type. To find the correct file extension for the Architect format, you can either export a flow from the Architect UI or look at the
flow definitionfor a flow type and access thefileExtensionproperty to get the value. If an extension is found on the file name other than what is expected, the correct extension will be appended to the end of the exported file as per the logic described previously.Returns:
Promise- Overrides:
- See:
-
exportToObjectAsync(callbackFunction, flowFormatopt) → {Promise}
-
Exports the flow to a JSON object. The object passed back in the callback function will be a JSON object with a content and fileName property where the content holds the flow export contents and the fileName property holds the file name where the export would be written if
ArchBaseFlow#exportToDirAsyncis called.Parameters:
Name Type Attributes Default Description callbackFunctioncallbackExportObject the function to call back with the export information contained in the parameter passed to it.
flowFormatstring <optional>
ArchEnums.FLOW_FORMAT_TYPES.architect the desired export format to use on an export. See
ArchEnums#FLOW_FORMAT_TYPESfor allowable export formats. If no format is used, it will default to the Architect format.Returns:
Promise- Overrides:
- See:
-
getExportFilePath(destinationDiropt, flowFormatopt, fileNameopt) → {string}
-
This function will return the file path where a flow export will be written when calling the
ArchBaseFlow#exportToDirAsyncmethod for the supplied destination directory and export flow format. A typical use case for this function would be to get the export file path prior to calling theArchBaseFlow#exportToDirAsyncso you could see if the file already exists and decide if you want to perform an export or not sinceArchBaseFlow#exportToDirAsyncwill attempt to overwrite a file if it already exists. Note that this uses the file system and should not be used when running in a browser.Parameters:
Name Type Attributes Default Description destinationDirstring <optional>
the directory where the flow export should be written. If no directory path is given, this method uses the current working directory. If a relative path is supplied, it will be resolved relative to the current working directory.
flowFormatstring <optional>
ArchEnums.FLOW_FORMAT_TYPES.architect the desired flow format to use for the export. See
ArchEnums#FLOW_FORMAT_TYPESfor allowable export formats. If no format is supplied, it will use the Architect format.fileNamestring <optional>
the file name to use for the exported flow. If a file extension is not added to the file name, it will use the default file extension for the desired export type for the desired export format and flow that you are exporting. If the format is YAML, the extension is always '.yaml' regardless of flow type. However, if it is the Architect format, the extension is unique per flow-type. To find the correct file extension for the Architect format, you can either export a flow from the Architect UI or look at the
flow definitionfor a flow type and access thefileExtensionproperty to get the value. If an extension is found on the file name other than what is expected, the correct extension will be appended to the end of the exported file as per the logic described previously.Returns:
string- Overrides:
- See:
-
getVariableById(variableId) → {ArchBaseVariable}
-
Returns the flow scoped variable for the supplied variable identifier ( if it exists ). If the variable name cannot be found, nothing is returned.
Parameters:
Name Type Description variableIdstring the supllied variable identifier to look up such as CALL_ANI.
Returns:
ArchBaseVariable- Overrides:
-
getVariableByName(variableName) → {ArchBaseVariable}
-
Returns the flow scoped variable for the supplied fully scoped variable name ( if it exists ). Remember, looking up variables by name is case insensitive. If the variable name cannot be found, nothing is returned.
Parameters:
Name Type Description variableNamestring the fully scoped variable name to look up such as Flow.MyVar.
Returns:
ArchBaseVariable- Overrides:
-
importFromContentAsync(exportContent, callbackFunctionopt) → {Promise}
-
Imports the flow content from the supplied content string. This content string should be for a flow of the same type as the one you're importing in to. Upon successful import, the callback function passed in will be called. Importing flow contents in to a flow is something where you should not attempt to do work with the flow on which this is being called until the callback is called.
Parameters:
Name Type Attributes Description exportContentstring the contents from a flow export.
callbackFunctionfunction <optional>
a function to call if the export content successfully loaded and configured on this flow. The first parameter passed to the callback function will be this Architect flow instance.
Returns:
Promise -
importFromFileAsync(exportFilePath, callbackFunctionopt) → {Promise}
-
Imports the flow content from the supplied file path. Upon successful import, the callback function passed in will be called. Importing flow contents in to a flow is something where you should not attempt to do work with the flow on which this is being called until the callback is called. Also note that this method should not be used if running in a browser.
Parameters:
Name Type Attributes Description exportFilePathstring the file path to an Architect flow export file that should be imported.
callbackFunctionfunction <optional>
a function to call if the export content successfully loaded and configured on this flow. The first parameter passed to the callback function will be this Architect flow instance.
Returns:
Promise- Overrides:
- See:
-
isFilterMatch(archFilterObject) → {boolean}
-
Returns whether or not this Architect Scripting object is a match for the supplied ArchFilterObject instance.
Parameters:
Name Type Description archFilterObjectArchFilterObject the object filter to use to determine if it's a match.
Returns:
boolean- Overrides:
-
loadAsync(flowVersionopt, callbackFunctionopt) → {Promise}
-
Loads a specific version of the flow. Any previously returned Architect Scripting objects associated with this flow should no longer be considered valid after loading new configuration.
Parameters:
Name Type Attributes Default Description flowVersionstring <optional>
"latest" the version of the flow to get. Valid values are "latest" to get the latest saved configuration of a flow, a version value such as "2.0" or "2", "debug" to get the currently published debug version configuration of a flow, or "published" to get the currently published version configuration of a flow. If you do not specify a version, then the latest saved configuration will be loaded.
callbackFunctioncallbackVoid <optional>
a callback function to call if the flow was loaded.
Returns:
Promise -- while this method returns a promise, you should use the callback function to perform any processing when the flow is loaded.
- Overrides:
-
logError(errorStr)
-
Logs an error to the logging service with a log header from this object's
logStrproperty value whenArchLogging#logErrorsis true.Parameters:
Name Type Description errorStrstring the error string to log.
- Overrides:
-
logErrorAndThrow(errorStr)
-
Logs an error to the logging service with a log header from this object's
logStrproperty value whenArchLogging#logErrorsis true and then throws the string in the errorStr parameter.Parameters:
Name Type Description errorStrstring the error string to log. This should be a non-blank string.
Throws:
- Throws the submitted error string.
- Overrides:
-
logNote(noteStr)
-
Logs a note to the logging service with a log header from this object's
logStrproperty value whenArchLogging#logNotesis true.Parameters:
Name Type Description noteStrstring the note string to log. This should be a non-blank string.
- Overrides:
-
logNoteVerbose(noteStr)
-
Logs a note to the logging service with a log header from this object's
logStrproperty value whenArchLogging#logNotesVerboseis true.Parameters:
Name Type Description noteStrstring the note string to log. This should be a non-blank string.
- Overrides:
-
logWarning(warningStr)
-
Logs a warning to the logging service with a log header from this object's
logStrproperty value whenArchLogging#logWarningsis true.Parameters:
Name Type Description warningStrstring the warning string to log. This should be a non-blank string.
- Overrides:
-
publishAsync(ensureSearchableopt) → {Promise}
-
Publishes the flow. This will do a validate, save, checkin and then publish last. Any of these steps can fail and reject the promise. Operations are not atomic.
Parameters:
Name Type Attributes Description ensureSearchableboolean <optional>
whether or not to poll after successful publish to ensure that the flow is available for flow search operations such as
ArchFactoryFlows#getFlowInfoByFlowNameAsyncorArchFactoryFlows#getFlowInfoByFlowIdAsyncReturns:
Promise -- On your promise's then handler, the first parameter passed to the then function will be this flow instance.
- Overrides:
-
removeVariable(archVariable) → {boolean}
-
This deletes the supplied variable from the flow. Remember you can call
ArchBaseVariable#canDeleteprior to calling this method to know if the supplied flow scoped variable can be deleted.Parameters:
Name Type Description archVariableArchBaseVariable the flow scoped variable you wish to delete
Returns:
boolean -- true if the variable was removed successfully, false otherwise.
- Overrides:
-
saveAsync() → {Promise}
-
Save the current flow configuration, creating the flow if needed.
Returns:
Promise -- On your promise's then handler, the first parameter passed to the then function will be this flow instance.
- Overrides:
-
traverse(callbackFunction, traverseFilteropt) → {number}
-
This method iterates over this object and ArchBaseCoreObject instances within it. For each object it will call the
ArchBaseObject#isFilterMatchmethod with a filter and call the supplied callback function if isMatch returns true. The callback will be passed anArchTraverseInfowith details about the match such as the match object itself along with current contextual information such as the object hierarchy for the match object relative to the object on which this traverse call is being made.The traverse
filteris one which you can create by callingArchFactoryFilters#createFilterObjectand then add desired clauses or clause containers to it. If not specified, this function will use adefault filter.Here is an example that does a simple flow traversal using the default filter and logs information about objects in the callback from the traverse object that's passed back:
archInboundCallFlow.traverse(function(traverseInfo) { archLogging.logNote(' Object : ' + traverseInfo.matchObject.logStr); archLogging.logNote(' Hierarchy: ' + traverseInfo.context.hierarchyStr); });This might be enough for most uses and you can check various aspects about the object in the callback such as "is this an Architect action?" by seeing if traverseInfo.matchObject.isArchBaseAction is true. You can specify a filter for the traversal code to use as well and only have it call your callback when the object's
ArchBaseCoreObject#isFilterMatchmethod returns true for the filter. Here's an example that creates a filter for callbacks onany type of transfer action, anydecision actionor objects whose name property case insensitively matches the word 'foo'. While this could all be done with one property callback clause the example will use multiple clauses for the sake of simplicity:const myTraverseFilter = filterFactory.createFilterObject(archEnums.FILTER_CONTAINER_OPERATORS.or); myTraverseFilter.addClausePropertyValueEquals('isArchBaseActionTransfer', true); myTraverseFilter.addClausePropertyValueEquals('isArchActionDecision', true); myTraverseFilter.addClausePropertyCallback('name', function(propValue, archContainingObject, propName) { // We fully spelled out the function signature above but archContainingObject and propName are // not needed in this case. The archContainingObject is the object that contains the // property and propName is the property name itself. We pass in propName because the same // function could be used for multiple property callback clauses. // Remember to return a boolean true, false or undefined from ths callback. :) return propValue && propValue.toLowerCase() === 'foo'; }); archTask.traverse(function(traverseContext) { // You will only be called back here for ArchBaseCoreObject instances that // have the isArchBaseActionTransfer or isArchActionDecision property values equal to true. }, myTraverseFilter);If you supply a filter with no clauses, this tells the traverse method to call the supplied callback function for every
ArchBaseCoreObjectit traverses.If you want traversal itself to stop after a callback, simply return boolean false from the callback function you supply to the traverse call.
The traverse method does not process deprecated property names such as
orgId,orgNameorlanguageSettings. Additionally it does not traverse in to properties that would "jump out" of the current traversal. An example of this would be if the code was traversing anArchActionJumpToMenuaction that it would not start traversing in to the menu that it jumps to. Another example would be aArchActionChangeStateaction where it would not traverse in to the target state of the action. This also means traversal does not traverse in to theArchBaseValue#flowLevelDefaultproperty.And lastly, as Scripting evolves over time with new versions, you can expect to get callbacks for new object types such as new actions or new properties on objects. As such, it's important not to assume any particular order in callbacks to keep code most compatible with traversal callbacks. Or if you use inequality checks in filter clauses remember that new "stuff" may satisfy an inequality check which may or may not be anticipated in your logic.
Note: This traverse method is a helper method and is very handy for iterating over Architect Scripting objects and their properties in a generic fashion with filtering capabilities. Obviously you can write your own custom traversal code if this implementation doesn't cut it for some reason. :)
This function returns the number of times it called the callback function.
Parameters:
Name Type Attributes Default Description callbackFunctioncallbackTraverseInfo the callback function to call for objects that match the traverse filter.
traverseFilterArchFilterObject <optional>
ArchFactoryFilters#createFilterTraverseDefaultthe filter to use when performing the traversal to determine which
ArchBaseCoreObjectinstances you wish to be called back for. If no filter is specified, this function will callArchFactoryFilters#createFilterTraverseDefaultand use that traversal default filter. The wantArchBaseValues parameter on that call is set to true.Returns:
number- Overrides:
-
unlockAsync(callbackFunctionopt) → {Promise}
-
Unlocks this flow.
Parameters:
Name Type Attributes Description callbackFunctioncallbackVoid <optional>
a callback function to call if the flow can be unlocked.
Returns:
Promise -- while this method returns a promise, you should use the callback function to perform any processing once this flow is unlocked.
- Overrides:
-
validateAsync() → {Promise.<ArchValidationResults>}
-
Validates the flow. Promise returns an
ArchValidationResultsinstance.Returns:
Promise.<ArchValidationResults> -- On your promise's then handler, the first parameter passed to the then function will be the validation results.
- Overrides: