Configuration and runtime graph for a sales/marketing journey: the set of stages, journey nodes (goals and actions), scoring, automations, exports and task definitions that together define how a lead moves through the funnel. Stored per repository branch and loaded through FunnelCache; FunnelManager reads a Funnel to evaluate incoming events, transition leads between nodes, run automations and score engagement. Configured in XML under the element name "funnel".

Group: Journeys

Implements: Serializable


Properties

PropertyReturnsDescription
automationsList<FunnelAutomation>Trigger/action automations attached to this funnel, checked by FunnelManager against each incoming FunnelEvent.
branchBranchThe repository branch this funnel is stored against, re-fetched from the current Hibernate session on each call.
cancelledActionsList<GoalAction>Actions run when a lead in this funnel is cancelled, i.e. lost.
categoriesList<FunnelTag>Task categories defined for this funnel's task definitions, used to group and filter tasks.
closedActionsList<GoalAction>Actions run when a lead in this funnel is closed, i.e. won.
customerActivitiesList<CustomerAction>Suggested customer interaction activities offered against leads in this funnel, such as a call or an email.
defaultBeginBeginThe Begin node leads enter this funnel's journey through by default, i.e. the one marked as its initial goal. Computed by init(); null until the funnel has been initialised.
derivedFieldsList<DerivedFunnelField>Fields whose value is calculated dynamically by a JS function, rather than being stored directly, alongside this funnel's regular fields. See findDerivedField to look one up by name.
disabledBooleanWhether this funnel is disabled. A null value is treated as not disabled - see isDisabled for the null-safe primitive check.
disabledbooleanNull-safe check of whether this funnel is disabled.
emailCapturePrefixStringPrefix used to recognise inbound emails as belonging to this funnel, matched against the leading part of the recipient address by LeadManApp when capturing leads from email.
entryPointsList<Begin>The Begin nodes that a lead can enter this funnel's journey through, i.e. those whose configured next node is a Goal. Computed by init() from this funnel's nodes; empty until the funnel has been initialised.
exportsList<FunnelExport>Named, reusable lead field sets this funnel's leads can be exported with. See findExport to look one up by name.
extraFieldsList<ExtraField>Custom fields collected on leads in this funnel, in addition to the built-in lead fields.
formattedNameStringDisplay name for this funnel: its title if set, otherwise its name, otherwise its repository's title or name, falling back to "Untitled journey" if none of those are available.
funnelRepoFunnelRepositoryThe FunnelRepository backing this funnel, resolved from its branch and cached in the current request's attributes.
funnelTestersList<FunnelTester>Rules identifying test accounts that should be handled differently to real leads in this funnel.
hiddenToSalesbooleanWhether this funnel is hidden from sales-facing lead lists and searches, such as FunnelManager.getNonHiddenFunnels. Defaults to false.
jsPathsList<String>Repository paths of the JS files loaded into this funnel's script engine, used by executeJs and by FunnelAutomation check functions and DerivedFunnelField calculations.
leadNumTemplateStringA KCode/MVEL template used to calculate a new lead's leadNum property when it is created in this funnel.
leadRoleDefsList<LeadRoleDef>Custom lead participant roles defined directly on this funnel. Does not include the legacy roles implied by Lead's built-in fields - use FunnelManager.getLeadRoleDefs for the combined list.
leadsGroupStringConfigured identifier of the group new leads for this funnel are added to - either a numeric group id or a group name. Use the no-arg leadsGroup() method to resolve this to the actual Group.
lostReasonsList<String>Reasons offered when a lead in this funnel is marked as lost, for selection on an EndGoalAction or CancelGoalAction.
nameStringPortable, path-safe identifier for this funnel, taken from its repository name. Used as the lookup key in FunnelCache and FunnelManager.
nodesList<JourneyNode>All journey nodes making up this funnel's graph - the goals, actions and begin nodes a lead moves between.
preferentialJobTitlesList<String>Job titles that cause a lead to be ranked higher in this funnel.
requestAttributesMap<String,Object>Scratch attributes attached to this funnel for the duration of the current request/thread, used to pass values such as a matched EmailItem between matches() and onEnter() on a journey node, and to cache getFunnelRepo's result. Not persisted.
scoringFactorsList<EngagementScoringFactor>Engagement scoring rules for this funnel, used by LeadScoringService.calcEngagementScore to compute a lead's engagement score.
sourcesList<String>Known lead sources for this funnel, such as "facebook" or "google ads", offered as suggestions in the admin UI. Not exhaustive - a lead's source is not restricted to values in this list.
stagesList<Stage>Ordered list of stages a lead progresses through in this funnel, for example cold, warm, hot. Stage position is used by stageNum and by EngagementScoringFactor's equalOrLess/equalOrGreater comparisons.
tagsList<FunnelTag>Tags defined for this funnel's task definitions, used to group and filter tasks.
taskDefsList<TaskDef>Task definitions this funnel can create tasks from. See findTaskDef, findTaskDefsByCategory and findTaskDefsByTag to look up individual definitions.
titleStringDisplay title for this funnel. Falls back to the repository's title, then its name, if not explicitly set - see getFormattedName for the resolved value to show in the UI.

Methods

get(String id) · getName() · getSources() · getTitle() · getLeadsGroup() · getStages() · getExtraFields() · getCustomerActivities() · getCancelledActions() · getClosedActions() · getLostReasons() · getFunnelTesters() · getHiddenToSales() · getLeadNumTemplate() · getDisabled() · getScoringFactors() · getPreferentialJobTitles() · getAutomations() · getJsPaths() · getCategories() · getTags() · getTaskDefs() · getLeadRoleDefs() · getExports() · getDerivedFields() · getEmailCapturePrefix() · executeJs(String function, Object args) · isDisabled() · addLostReason(String s) · addClosedAction(GoalAction a) · addCancelledAction(GoalAction a) · addCustomerAction(boolean b, String id, String text) · addExtraField(String name, String title, boolean required, boolean aggregate) · addStage(String code, String desc) · stageNum(String stageName) · addNode(JourneyNode b) · getEntryPoints() · getNodes() · getBranch() · extraField(String fieldName) · getRequestAttributes() · getFunnelRepo() · getDefaultBegin() · taskGoal(String taskName) · customerActivity(String id) · leadsGroup() · getFormattedName() · findExport(String exportName) · findDerivedField(String name) · hasForks() · findAutomationById(String id) · findTaskDef(String id) · findLeadRoleDef(String roleKey) · findTaskDefsByCategory(String c) · findTaskDefsByTag(String t) · addTaskTag(String id, String title) · addTaskCategory(String id, String title) · addTaskDef(String taskName, String title, String category, String tag) · nodeTitle(String nodeName)

get(String id)

Returns: JourneyNode

Looks up a journey node (a goal, action or begin) in this funnel by its node id.

ParameterDescription
idthe node id to look up

getName()

Returns: String

Portable, path-safe identifier for this funnel, taken from its repository name. Used as the lookup key in FunnelCache and FunnelManager.

getSources()

Returns: List<String>

Known lead sources for this funnel, such as "facebook" or "google ads", offered as suggestions in the admin UI. Not exhaustive - a lead's source is not restricted to values in this list.

getTitle()

Returns: String

Display title for this funnel. Falls back to the repository's title, then its name, if not explicitly set - see getFormattedName for the resolved value to show in the UI.

getLeadsGroup()

Returns: String

Configured identifier of the group new leads for this funnel are added to - either a numeric group id or a group name. Use the no-arg leadsGroup() method to resolve this to the actual Group.

getStages()

Returns: List<Stage>

Ordered list of stages a lead progresses through in this funnel, for example cold, warm, hot. Stage position is used by stageNum and by EngagementScoringFactor's equalOrLess/equalOrGreater comparisons.

getExtraFields()

Returns: List<ExtraField>

Custom fields collected on leads in this funnel, in addition to the built-in lead fields.

getCustomerActivities()

Returns: List<CustomerAction>

Suggested customer interaction activities offered against leads in this funnel, such as a call or an email.

getCancelledActions()

Returns: List<GoalAction>

Actions run when a lead in this funnel is cancelled, i.e. lost.

getClosedActions()

Returns: List<GoalAction>

Actions run when a lead in this funnel is closed, i.e. won.

getLostReasons()

Returns: List<String>

Reasons offered when a lead in this funnel is marked as lost, for selection on an EndGoalAction or CancelGoalAction.

getFunnelTesters()

Returns: List<FunnelTester>

Rules identifying test accounts that should be handled differently to real leads in this funnel.

getHiddenToSales()

Returns: boolean

Whether this funnel is hidden from sales-facing lead lists and searches, such as FunnelManager.getNonHiddenFunnels. Defaults to false.

getLeadNumTemplate()

Returns: String

A KCode/MVEL template used to calculate a new lead's leadNum property when it is created in this funnel.

getDisabled()

Returns: Boolean

Whether this funnel is disabled. A null value is treated as not disabled - see isDisabled for the null-safe primitive check.

getScoringFactors()

Returns: List<EngagementScoringFactor>

Engagement scoring rules for this funnel, used by LeadScoringService.calcEngagementScore to compute a lead's engagement score.

getPreferentialJobTitles()

Returns: List<String>

Job titles that cause a lead to be ranked higher in this funnel.

getAutomations()

Returns: List<FunnelAutomation>

Trigger/action automations attached to this funnel, checked by FunnelManager against each incoming FunnelEvent.

getJsPaths()

Returns: List<String>

Repository paths of the JS files loaded into this funnel's script engine, used by executeJs and by FunnelAutomation check functions and DerivedFunnelField calculations.

getCategories()

Returns: List<FunnelTag>

Task categories defined for this funnel's task definitions, used to group and filter tasks.

getTags()

Returns: List<FunnelTag>

Tags defined for this funnel's task definitions, used to group and filter tasks.

getTaskDefs()

Returns: List<TaskDef>

Task definitions this funnel can create tasks from. See findTaskDef, findTaskDefsByCategory and findTaskDefsByTag to look up individual definitions.

getLeadRoleDefs()

Returns: List<LeadRoleDef>

Custom lead participant roles defined directly on this funnel. Does not include the legacy roles implied by Lead's built-in fields - use FunnelManager.getLeadRoleDefs for the combined list.

getExports()

Returns: List<FunnelExport>

Named, reusable lead field sets this funnel's leads can be exported with. See findExport to look one up by name.

getDerivedFields()

Returns: List<DerivedFunnelField>

Fields whose value is calculated dynamically by a JS function, rather than being stored directly, alongside this funnel's regular fields. See findDerivedField to look one up by name.

getEmailCapturePrefix()

Returns: String

Prefix used to recognise inbound emails as belonging to this funnel, matched against the leading part of the recipient address by LeadManApp when capturing leads from email.

executeJs(String function, Object args)

Returns: Object

Calls a named JS function in this funnel's script engine (built from jsPaths), passing the given arguments through. Used to run FunnelAutomation check functions, DerivedFunnelField calculations and similar scripted behaviour configured on the funnel. Involves script execution so is not cheap; errors from the script are logged and swallowed, returning null.

ParameterDescription
functionthe name of the JS function to call
argsarguments passed through to the function

isDisabled()

Returns: boolean

Null-safe check of whether this funnel is disabled.

addLostReason(String s)

Returns: Funnel

Adds a reason to the list offered when a lead in this funnel is marked lost, creating the list if needed.

ParameterDescription
sthe lost reason to add

addClosedAction(GoalAction a)

Returns: void

Adds an action to be run when a lead in this funnel is closed (won), creating the action list if needed.

ParameterDescription
athe action to run on closure

addCancelledAction(GoalAction a)

Returns: void

Adds an action to be run when a lead in this funnel is cancelled (lost), creating the action list if needed.

ParameterDescription
athe action to run on cancellation

addCustomerAction(boolean b, String id, String text)

Returns: Funnel

Adds a suggested customer activity to this funnel, creating the activity list if needed.

ParameterDescription
bwhether the activity is enabled by default
idunique identifier for the activity
textthe activity's display text

addExtraField(String name, String title, boolean required, boolean aggregate)

Returns: Funnel

Adds a custom text field to this funnel's leads, creating the extra field list if needed.

ParameterDescription
namethe field's portable identifier
titlethe field's display label
requiredwhether the field must be filled in
aggregatewhether the field's values should be aggregated in reports

addStage(String code, String desc)

Returns: void

Appends a stage to this funnel's ordered stage list, creating the list if needed.

ParameterDescription
codethe stage's portable identifier
descthe stage's display description

stageNum(String stageName)

Returns: Integer

Zero-indexed ordinal position of the given stage name in this funnel's stage list, used to compare stages for order, for example by EngagementScoringFactor's equalOrLess/equalOrGreater modes.

ParameterDescription
stageNamethe stage name to look up

addNode(JourneyNode b)

Returns: void

Adds a journey node (a goal, action or begin) to this funnel, indexing it by its node id so it can be found with get().

ParameterDescription
bthe node to add

getEntryPoints()

Returns: List<Begin>

The Begin nodes that a lead can enter this funnel's journey through, i.e. those whose configured next node is a Goal. Computed by init() from this funnel's nodes; empty until the funnel has been initialised.

getNodes()

Returns: List<JourneyNode>

All journey nodes making up this funnel's graph - the goals, actions and begin nodes a lead moves between.

getBranch()

Returns: Branch

The repository branch this funnel is stored against, re-fetched from the current Hibernate session on each call.

extraField(String fieldName)

Returns: ExtraField

Finds one of this funnel's extra field definitions by name.

ParameterDescription
fieldNamethe field name to look up

getRequestAttributes()

Returns: Map<String,Object>

Scratch attributes attached to this funnel for the duration of the current request/thread, used to pass values such as a matched EmailItem between matches() and onEnter() on a journey node, and to cache getFunnelRepo's result. Not persisted.

getFunnelRepo()

Returns: FunnelRepository

The FunnelRepository backing this funnel, resolved from its branch and cached in the current request's attributes.

getDefaultBegin()

Returns: Begin

The Begin node leads enter this funnel's journey through by default, i.e. the one marked as its initial goal. Computed by init(); null until the funnel has been initialised.

taskGoal(String taskName)

Returns: TaskGoal

Finds a TaskGoal node in this funnel matching the given task name or task definition id.

ParameterDescription
taskNamethe task name or task definition id to match

customerActivity(String id)

Returns: CustomerAction

Finds one of this funnel's suggested customer activities by id.

ParameterDescription
idthe activity id to look up

leadsGroup()

Returns: Group

Resolves the Group new leads for this funnel are added to. Tries getLeadsGroup as a numeric group id first, then as a group name, and finally falls back to the app's default leads group when leadsGroup is blank. Involves a database lookup.

getFormattedName()

Returns: String

Display name for this funnel: its title if set, otherwise its name, otherwise its repository's title or name, falling back to "Untitled journey" if none of those are available.

findExport(String exportName)

Returns: FunnelExport

Finds one of this funnel's named exports by name.

ParameterDescription
exportNamethe export name to look up

findDerivedField(String name)

Returns: DerivedFunnelField

Finds one of this funnel's derived field definitions by name.

ParameterDescription
namethe derived field name to look up

hasForks()

Returns: boolean

Checks whether this funnel's journey contains any ForkGoalAction nodes, i.e. whether a lead's journey through it can split into parallel forks.

findAutomationById(String id)

Returns: FunnelAutomation

Finds one of this funnel's automations by id.

ParameterDescription
idthe automation id to look up

findTaskDef(String id)

Returns: TaskDef

Finds one of this funnel's task definitions by its task name.

ParameterDescription
idthe task name to look up

findLeadRoleDef(String roleKey)

Returns: LeadRoleDef

Finds a custom lead role defined directly on this funnel. Does not know about the system roles implied by Lead's legacy fields - use FunnelManager.getLeadRoleDefs/findLeadRoleDef for the combined list.

ParameterDescription
roleKeythe role key to look up

findTaskDefsByCategory(String c)

Returns: List<TaskDef>

Finds all of this funnel's task definitions in the given category.

ParameterDescription
cthe category id to match

findTaskDefsByTag(String t)

Returns: List<TaskDef>

Finds all of this funnel's task definitions carrying the given tag.

ParameterDescription
tthe tag id to match

addTaskTag(String id, String title)

Returns: FunnelTag

Adds a task tag to this funnel, creating the tag list if needed.

ParameterDescription
idthe tag's portable identifier
titlethe tag's display label

addTaskCategory(String id, String title)

Returns: FunnelTag

Adds a task category to this funnel, creating the category list if needed.

ParameterDescription
idthe category's portable identifier
titlethe category's display label

addTaskDef(String taskName, String title, String category, String tag)

Returns: TaskDef

Adds a task definition to this funnel, creating the task definition list if needed.

ParameterDescription
taskNameunique name for the task definition, also used as its created tasks' name
titletemplate used as the title of tasks created from this definition
categoryid of the category to file the task definition under
tagid of a tag to apply to the task definition, or null for none

nodeTitle(String nodeName)

Returns: String

Display title for a journey node in this funnel, falling back to the node's id if it has no title or does not exist.

ParameterDescription
nodeNamethe node id to look up
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.