abstract ArchBaseFlow(coreFlowViewModel)

new abstract ArchBaseFlow(coreFlowViewModel)

The base Architect Scripting class for flows. Instances of this class will be created by Architect Scripting as needed. The ArchFactoryFlows has methods available to create flows.

Parameters:
Name Type Description
coreFlowViewModel Object

( Internal ) an Architect core flow view model.

See:

Extends

Members

static, readonly definition :ArchDefinitionFlow

Returns a definition for this flow type which provides access to information about this flow such as ArchDefinitionFlow#isAvailable.

// Example code - remember, only access this when your Scripting session is connected!
var archIncomingCallFlowDefinition = scripting.viewModels.flows.ArchFlowInboundCall.definition;
// or for a given ArchFlowInboundCall flow instance:
var archIncomingCallFlowDefinition = archInboundCallFlowInstance.definition;

static, readonly displayTypeName :string

Returns the display type name string 'ArchBaseFlow'.

static, readonly isArchBaseFlow :boolean

Returns true indicating that this is an ArchBaseFlow instance.

readonly dataTypes :Object

Accessing this property returns an object with properties whose keys are data type names and values are ArchDataType instances.

description :string

The description of the flow

readonly division :ArchDivision

Returns the division associated with this flow. This method first calls ArchOrganizationInfo#areDivisionsAvailable to ensure that divisions are available. If not available, nothing is returned.

readonly flowType :string

The type of the flow. The string values in ArchEnums#FLOW_TYPES lists valid flow type values.

readonly id :string

The identifier string for this object.

Inherited From:

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#settingsMenu will have a blank identifier along with the settings returned from ArchMenu#settingsSpeechRec. Note that this is an extremely rare case.

Inherited From:
See:

readonly isArchBaseCoreObject :boolean

Returns true indicating that this is an ArchBaseCoreObject instance.

Inherited From:

readonly isCreated :boolean

Returns whether or not the flow is created in Genesys Cloud.

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.

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.

readonly isVariableContainer :boolean

Returns true indicating the flow acts as a variable container which means you can add variables to it.

readonly languageSettings :ArchSettingsSupportedLanguagesFlow

The language settings for the flow. This property is now deprecated. Please replace calls to this property with ArchBaseFlow#settingsSupportedLanguages instead.

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.

Inherited From:

name :string

The name of the flow

readonly settingsActionDefaults :ArchSettingsActionDefaults

Returns the action default settings for the flow.

readonly settingsErrorHandling :ArchSettingsEventErrorFlow

Returns the error handling settings for the flow.

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#supportsLanguages prior to calling this method to see if a flow supports languages or not.

readonly supportsAudio :boolean

Returns whether or not this flow supports audio channel.

readonly supportsDefaultLanguage :boolean

Returns whether or not this flow supports setting a supported language as the default.

readonly supportsErrorHandling :boolean

Returns whether or not this flow supports error handling.

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.

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.

See:

readonly variables :Array.<ArchBaseVariable>

Returns an array of variables defined at the flow scope for this flow.

Methods

addFlowSupportedLanguage(archLanguage, setAsDefaultLanguageopt) → {ArchSettingsSupportedLanguage}

Helper method that accesses the flow's settingsSupportedLanguages and then calls the addSupportedLanguage function on the returned ArchSettingsSupportedLanguagesFlow value.

Parameters:
Name Type Attributes Description
archLanguage ArchLanguage

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.

setAsDefaultLanguage boolean <optional>

if true, the language will be set as the default language on the flow.

addVariable(name, type, descriptionopt) → {ArchBaseVariable}

This adds a new variable to the flow.

Parameters:
Name Type Attributes Description
name string

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.

type ArchDataType

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#isScriptCreatableForFlowType or ArchDataType#isScriptCreatableForFlow method.

description string <optional>

the description for the new variable.

Returns:
ArchBaseVariable

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

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
ensureSearchable boolean <optional>

whether or not to poll after successful checkin to ensure that the flow is available for flow search operations such as ArchFactoryFlows#getFlowInfoByFlowNameAsync or ArchFactoryFlows#getFlowInfoByFlowIdAsync

Returns:
Promise -
  • On your promise's then handler, the first parameter passed to the then function will be this flow instance.

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
forceUnlock boolean <optional>

if true, will force an unlock of the flow.

callbackFunction callbackVoid <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.

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.

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
destinationDir string <optional>

the directory where the flow export should be saved.

callbackFunction callbackExportFullPath <optional>

the function to call back and pass in the full path where the flow export was saved.

flowFormat string <optional>
ArchEnums.FLOW_FORMAT_TYPES.architect

the desired flow format to use for the export. See ArchEnums.FLOW_FORMAT_TYPES for allowable export formats. If no format is used, it will default to the Architect format.

fileName string <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 definition for a flow type and access the fileExtension property 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
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#exportToDirAsync is called.

Parameters:
Name Type Attributes Default Description
callbackFunction callbackExportObject

the function to call back with the export information contained in the parameter passed to it.

flowFormat string <optional>
ArchEnums.FLOW_FORMAT_TYPES.architect

the desired export format to use on an export. See ArchEnums.FLOW_FORMAT_TYPES for allowable export formats. If no format is used, it will default to the Architect format.

Returns:
Promise
See:

getExportFilePath(destinationDiropt, flowFormatopt, fileNameopt) → {string}

This function will return the file path where a flow export will be written when calling the ArchBaseFlow#exportToDirAsync method 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 the ArchBaseFlow#exportToDirAsync so you could see if the file already exists and decide if you want to perform an export or not since ArchBaseFlow#exportToDirAsync will 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
destinationDir string <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.

flowFormat string <optional>
ArchEnums.FLOW_FORMAT_TYPES.architect

the desired flow format to use for the export. See ArchEnums.FLOW_FORMAT_TYPES for allowable export formats. If no format is supplied, it will use the Architect format.

fileName string <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 definition for a flow type and access the fileExtension property 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
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
variableId string

the supllied variable identifier to look up such as CALL_ANI.

Returns:
ArchBaseVariable

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
variableName string

the fully scoped variable name to look up such as Flow.MyVar.

Returns:
ArchBaseVariable

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
exportContent string

the contents from a flow export.

callbackFunction function <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
See:

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
exportFilePath string

the file path to an Architect flow export file that should be imported.

callbackFunction function <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
See:

isFilterMatch(archFilterObject) → {boolean}

Returns whether or not this Architect Scripting object is a match for the supplied ArchFilterObject instance.

Parameters:
Name Type Description
archFilterObject ArchFilterObject

the object filter to use to determine if it's a match.

Returns:
boolean
Inherited From:

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
flowVersion string <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.

callbackFunction callbackVoid <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.

logError(errorStr)

Logs an error to the logging service with a log header from this object's logStr property value when ArchLogging#logErrors is true.

Parameters:
Name Type Description
errorStr string

the error string to log.

Inherited From:

logErrorAndThrow(errorStr)

Logs an error to the logging service with a log header from this object's logStr property value when ArchLogging#logErrors is true and then throws the string in the errorStr parameter.

Parameters:
Name Type Description
errorStr string

the error string to log. This should be a non-blank string.

Throws:
  • Throws the submitted error string.
Inherited From:

logNote(noteStr)

Logs a note to the logging service with a log header from this object's logStr property value when ArchLogging#logNotes is true.

Parameters:
Name Type Description
noteStr string

the note string to log. This should be a non-blank string.

Inherited From:

logNoteVerbose(noteStr)

Logs a note to the logging service with a log header from this object's logStr property value when ArchLogging#logNotesVerbose is true.

Parameters:
Name Type Description
noteStr string

the note string to log. This should be a non-blank string.

Inherited From:

logWarning(warningStr)

Logs a warning to the logging service with a log header from this object's logStr property value when ArchLogging#logWarnings is true.

Parameters:
Name Type Description
warningStr string

the warning string to log. This should be a non-blank string.

Inherited From:

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
ensureSearchable boolean <optional>

whether or not to poll after successful publish to ensure that the flow is available for flow search operations such as ArchFactoryFlows#getFlowInfoByFlowNameAsync or ArchFactoryFlows#getFlowInfoByFlowIdAsync

Returns:
Promise -
  • On your promise's then handler, the first parameter passed to the then function will be this flow instance.

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.

traverse(callbackFunction, traverseFilteropt) → {number}

This method iterates over this object and ArchBaseCoreObject instances within it. For each object it will call the ArchBaseObject#isFilterMatch method with a filter and call the supplied callback function if isMatch returns true. The callback will be passed an ArchTraverseInfo with 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 filter is one which you can create by calling ArchFactoryFilters#createFilterObject and then add desired clauses or clause containers to it. If not specified, this function will use a default 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#isFilterMatch method returns true for the filter. Here's an example that creates a filter for callbacks on any type of transfer action, any decision action or 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 ArchBaseCoreObject it 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, orgName or languageSettings. 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 an ArchActionJumpToMenu action that it would not start traversing in to the menu that it jumps to. Another example would be a ArchActionChangeState action where it would not traverse in to the target state of the action. This also means traversal does not traverse in to the ArchBaseValue#flowLevelDefault property.

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
callbackFunction callbackTraverseInfo

the callback function to call for objects that match the traverse filter.

traverseFilter ArchFilterObject <optional>
ArchFactoryFilters#createFilterTraverseDefault

the filter to use when performing the traversal to determine which ArchBaseCoreObject instances you wish to be called back for. If no filter is specified, this function will call ArchFactoryFilters#createFilterTraverseDefault and use that traversal default filter. The wantArchBaseValues parameter on that call is set to true.

Returns:
number
Inherited From:

unlockAsync(callbackFunctionopt) → {Promise}

Unlocks this flow.

Parameters:
Name Type Attributes Description
callbackFunction callbackVoid <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.

validateAsync() → {Promise.<ArchValidationResults>}

Validates the flow. Promise returns an ArchValidationResults instance.

Returns:
Promise.<ArchValidationResults> -
  • On your promise's then handler, the first parameter passed to the then function will be the validation results.