Registration API a repository app's server side JavaScript uses to declare everything the app contributes to the platform. An instance is created for each installed app and is bound into the app's script engine as the global variable controllerMappings. It is also the object model that the app's controllers.xml file deserialises into. App code calls the builder and add methods on it while the engine is initialising to register controllers, portlets, menus, roles, reports, event listeners, journey fields, KEditor components, payment and SMS providers, MCP tools and more. Registration only takes effect during initialisation. Once init has finished the list is marked immutable and most add methods silently ignore further calls.

Group: App Definitions

Implements: Serializable, JsExecutor


Properties

PropertyReturnsDescription
adminMappingsList<ControllerMapping>Controller mappings this app serves in the admin console, each binding a URL pattern to a JavaScript function and template.
adminPortletMappingsList<PortletMapping>Portlets this app contributes to admin pages. A portlet mapping names the page section it renders into and the function and template used to render it.
appendConfigFunctionObjectFunction registered by appendConfigFunction that lists this app's configuration items. It is called with a config item list builder, for example function myConfigAppender(configBuilder) that builds a properties map per item and calls configBuilder.add with the item name, type and properties.
appIndexersFunctionObjectFunction registered by appIndexersFunction that returns this app's search indexers. Whether it is present is cached per account, so apps without indexers are not initialised unnecessarily.
applyConfigFunctionObjectFunction registered by applyConfigFunction that applies imported configuration changes to this app.
appNameStringName of the app this mapping list belongs to, as installed on the account, for example admin-lib.
authenticationHandlerMappingsList<JsAuthHandlerMapping>Custom authentication handlers this app registered through the authentication handler builder.
autoApplyTypeIdsList<String>Configuration item type identifiers this app is willing to have applied automatically, rather than only on an explicit import.
browseResourcesFunctionObjectFunction registered by browseResourcesFunction that lists the app's resources when a website path is browsed.
builtTablesList<Table>Join tables built by the app through addJoinTable. These are the concrete table objects registered with the query subsystem.
captchaVerifyFnStringName of the JavaScript function this app provides to verify a captcha response, as registered by the captcha method. Its presence is what marks the app as a captcha provider.
checkoutRuleTypesList<RepoAppCustomCheckoutRuleType>Custom shopping cart checkout rule types this app contributes, registered through the checkout rule type builder.
componentsList<KEditorComponent>KEditor components this app contributes, registered through the addComponent methods or declared as component elements in controllers.xml.
emailSenderDetailsEmailSenderDetailsEmail sender registration for this app, set by building email sender details. Its presence is what marks the app as able to send email.
engagementScoringFactorTypeList<EngagementScoringFactorType>Engagement scoring factor types registered by this app through addEngagementScoringFactorType.
engineKademiScriptEngineScript engine the app's JavaScript runs in, created during initialisation from the app's sources and engine version.
esMappingsDetailsList<ESMappingsDetails>
eventListenersList<RepoAppEventListener>Event listeners this app has registered through addEventListener and addEventListenerForType. Each pairs an event type or class with the function to run.
funnelActionTypesList<FunnelActionType>Funnel action types registered by this app through addFunnelActionType. A funnel action type is a step an automation can perform when it runs.
funnelActionTypesFunctionObjectJavaScript function registered by funnelActionTypesFunction that builds funnel action types on demand.
funnelTriggerTypesList<FunnelTriggerType>Funnel trigger types registered by this app through addFunnelTriggerType. A funnel trigger type defines an event that can start or advance an automation.
funnelTriggerTypesFunctionObjectJavaScript function registered by funnelTriggerTypesFunction that builds funnel trigger types on demand.
hashStringGit style content hash of the app repository branch that this mapping list was built from. Used to look up the app's file contents through the data session manager.
indexQueryActionTypesList<IndexQueryActionType>Deprecated no-op, retained for backwards compatibility with apps that still call it. Always returns null, because index query action types are now registered through the implementation builder for indexQueryActionTypes.
initDateDateTime at which the app's engine was last initialised. Useful for telling whether a deployed change has been picked up.
initErrorExceptionException that stopped the app's engine from initialising, most often a JavaScript syntax or load error. When this is set the app is loaded but non functional.
initLogsList<String>Log lines captured while the app's engine was being initialised, used to show load time messages in the app admin screens.
journeyFieldsList<Field>Statically declared fields this app contributes for use in segments, journeys and queries. Dynamically produced fields come from the journey fields function instead.
journeyFieldsFunctionObjectFunction registered by journeyFieldsFunction that produces this app's fields dynamically.
jsImplementationsMap<String,JsImplementation>Implementations this app supplies for named extension points, keyed by interface name. Created on first access, so this never returns null.
jsServicesMap<String,JsService>Named JavaScript services this app publishes for other apps to call, keyed by service name. Created on first access, so this never returns null.
listList<ControllerMapping>Website controller mappings registered by this app, the same list returned by getWebsiteMappings.
mailboxMappingsList<MailboxMapping>Mailbox handlers this app registered through the mailbox controller, each binding an inbound email address pattern to a function. Created on first access, so this never returns null.
menuMappingsList<MenuMapping>Menu handlers this app registered through the menu controller, which let the app contribute items to menus at runtime. Created on first access, so this never returns null.
menusList<AppMenuItem>Admin menu items this app adds, as declared by the menu elements in controllers.xml.
metricTypesList<MetricType>Metric types registered by this app through newMetricTypeBuilder. The list is made immutable once the app has initialised.
nodeTypesList<NodeTypeBean>Journey node types this app contributes, registered through addNodeType, addActionNodeType and addGoalNodeType.
onAppDisabledStringName of the function called when the app is disabled on an account, as declared by the onAppDisabled attribute in controllers.xml.
onAppEnabledStringName of the function called when the app is enabled on an account, as declared by the onAppEnabled attribute in controllers.xml.
onAppUpdatedStringName of the function called when the app is updated to a new version, as declared by the onAppUpdated attribute in controllers.xml.
orgTabMappingsList<ProfileTabMapping>Extra tabs and summary panels this app adds to the admin organisation page, registered through adminOrgTab.
orgTimelineMappingProfileTimelineMappingFunction this app contributes to the organisation timeline, registered through setOrgTimelineFunction.
paymentProviderDetailsPaymentProviderDetailsPayment provider registration for this app, set by building payment provider details. Its presence is what marks the app as a payment provider for shopping carts.
pointsExpiryRuleTypesList<PointsExpiryRuleType>Points expiry rule types this app contributes, registered through the points expiry rule type builder. These decide when awarded points expire.
pointsRuleTypesList<PointsRuleType>Points rule types this app contributes, registered through the points rule type builder. These decide how points are awarded.
profileTabMappingsList<ProfileTabMapping>Extra tabs and summary panels this app adds to the admin profile page, registered through adminProfileTab.
profileTimelineMappingProfileTimelineMappingFunction this app contributes to the user timeline, registered through setUserTimelineFunction. It is called to add stream items to a profile's timeline.
promotionMechanicTypesList<PromotionMechanicType>Promotion mechanic types this app contributes, registered through the promotion mechanic type builder.
queriesList<RepoAppQuery>Saved search queries this app contributes, registered through addQuery from JSON files in the app repository.
queryTablesList<RepoQueryTableDef>Query table definitions registered by the app through addTableDef. A query table exposes a JavaScript function as a tabular data source that reports and the admin UI can select from.
recipeRecipeRecipe declared by the app, describing the ordered stages and steps used to configure the app after it is enabled.
repoAppSettingsList<RepoAppSettings>Settings declarations for this app, from the settings elements in controllers.xml. They describe the configuration fields shown when an administrator sets the app up.
repoNameStringName of the repository the app was loaded from. Set to the same value as the app name during initialisation.
reportsList<Report>Reports this app contributes, from both JSON report files and reports registered in JavaScript. The list is made immutable once the app has initialised.
rolesList<Role>Security roles this app declares, combining both the original role declarations and the version two roles from controllers.xml. Builds a new list on each call.
signinProviderMappingsList<RepoSigninProviderBean>Admin sign in providers this app contributes, such as an external identity provider offered on the admin sign in page.
signinProvidersFnStringName of the function that returns this app's admin sign in providers, as registered through signinProviderDetails.
smsProviderDetailsSmsProviderDetailsSMS provider registration for this app, set by building SMS provider details. Its presence is what marks the app as able to send text messages.
sourcesList<String>Paths of the JavaScript source files the app loads into its engine, in the order they are declared in controllers.xml.
tableActionHandlersList<TableActionHandler>Table action handlers registered by this app through newTableActionHandlerBuilder.
templatesList<TemplateDef>Page and email templates this app makes available to content editors, registered through addTemplate and addEdmTemplate.
triggerTypeMappingsList<TriggerTypeMapping>Legacy automation trigger types registered through automationTrigger. New apps should register funnel trigger types with addFunnelTriggerType instead.
websiteMappingsList<ControllerMapping>Controller mappings this app serves on website root folders, each binding a URL pattern to a JavaScript function and template.
websitePortletMappingsList<PortletMapping>Portlets this app contributes to website pages, including the captcha portlet registered by the captcha method.
websiteSigninProviderMappingsList<RepoSigninProviderBean>Website sign in providers this app contributes, offered on website sign in pages rather than the admin console.
websiteSigninProvidersFnStringName of the function that returns this app's website sign in providers, as registered through websiteSigninProviderDetails.

Methods

getHash() · findHash(String path) · listFiles(String path) · getRecipe() · getQueryTables() · getBuiltTables() · promotionMechanicTypeBuilder(String id, String title) · templateDefBuilder(String path, String name) · pointsRuleTypeBuilder(String id, String title) · pointsExpiryRuleTypeBuilder(String id, String title) · checkoutRuleTypeBuilder(String id, String title) · indexQueryActionTypeBuilder(String id, String title) · getIndexQueryActionTypes() · getFunnelTriggerTypes() · addFunnelTriggerType(String id, String title, String eventId) · addFunnelTriggerType(String id, String title, String eventId, List<FunnelTriggerType> list) · funnelTriggerTypesFunction(Object fn) · getFunnelTriggerTypesFunction() · getFunnelActionTypes() · addFunnelActionType(String id, String title) · addFunnelActionType(String id, String title, List<FunnelActionType> actionTypes) · funnelActionTypesFunction(Object fn) · getFunnelActionTypesFunction() · getCaptchaVerifyFn() · captcha(String captchaVerifyFn, String portletTemplate, String portletInitFunction) · addQuery(String path, List<String> indexNames, List<String> roleNames) · addTableDef(String id, String desc, String functionName) · addTableDef(String id, String desc, String functionName, String headersFnName) · joinTableBuilder() · addJoinTable(JoinTableBuilder b) · addTemplate(String parentPath, String fileName, String description, boolean contentTemplate) · addEdmTemplate(String parentPath, String fileName, String description, boolean contentTemplate) · addNodeType(String name, String template) · addActionNodeType(String name, String template, String jsMethod) · addGoalNodeType(String name, String jsTemplate, String jsMethod) · addGoalNodeType(String name, String jsTemplate, String jsMethod, String jsOnEnterMethod) · addEngagementScoringFactorType(String id, String label, Object getProperties, Object findEngagementDatesFn) · getEngagementScoringFactorType() · newTableActionHandlerBuilder() · getTableActionHandlers() · newMetricTypeBuilder() · getMetricTypes() · addJourneyField(String id, String label, String type, String input, List<String> operators, Object evalFunction) · addNumericJourneyField(String id, String label, boolean integer, Object evalFunction) · addTextJourneyField(String id, String label, Object evalFunction) · addTextJourneyField(String id, String label, Object evalFunction, List<Field> fields) · addFieldV2(String id, String label, String returnType, Object parentTypes, Object evalFunction) · newFieldBuilder(String id, String label) · addFieldV2(String id, String label, String returnType, Object parentTypes, Object evalFunction, List<Field> fields) · addJourneyFieldSelect(String id, String label, String type, List<String> values, List<String> operators, Object evalFunction) · addJourneyFieldSelect(String id, String label, String type, List<String> values, List<String> operators, Object evalFunction, List<Field> fields) · addComponent(String compId, String type, String desc, String jsFile, String editorHtml, String previewImage, String renderTemplate, String settingsTemplate) · addComponent(String compId, String type, String desc, String categories, String jsFile, String editorHtml, String previewImage, String renderTemplate, String settingsTemplate) · addComponent(String appId, String compId, String type, String desc) · addComponent(String appId, String compId, String type, String desc, String categories) · addComponent(String appId, String compId, List<String> types, String desc, String categories) · addComponent(String appId, String compId) · browseResourcesFunction(Object fn) · getBrowseResourcesFunction() · appIndexersFunction(Object fn) · getAppIndexersFunction() · appendConfigFunction(Object fn) · getAppendConfigFunction() · applyConfigFunction(Object fn) · getApplyConfigFunction() · getAutoApplyTypeIds() · getList() · getSources() · getMenus() · getInitDate() · getInitError() · getInitLogs() · getEngine() · getOnAppUpdated() · getOnAppEnabled() · getOnAppDisabled() · getWebsiteMappings() · getAdminMappings() · getAdminPortletMappings() · getTemplates() · getWebsitePortletMappings() · getProfileTabMappings() · getOrgTabMappings() · getTriggerTypeMappings() · getSigninProviderMappings() · getWebsiteSigninProviderMappings() · getEventListeners() · getProfileTimelineMapping() · getOrgTimelineMapping() · getJsServices() · newServiceBuilder(String serviceName) · getJsImplementations() · newImplementationBuilder(String interfaceName) · getDynamicIdpPaths(String type) · getWebsocketMapping(String type) · getSseMapping(String type) · getWebsiteMcpMapping(String type) · getAdminMcpMapping(String type) · getAuthenticationHandlerMappings() · getMailboxMappings() · getMenuMappings() · paymentProviderDetails() · smsProviderDetails() · emailSenderDetails() · adminController() · websiteController() · adminPortletController() · websitePortletController() · websocketController() · dynamicIdpPaths() · sseController() · websiteMcpController() · adminMcpController() · authenticationHandler() · adminProfileTab() · adminOrgTab() · mailboxController() · menuController() · automationTrigger() · signinProvider() · websiteSigninProvider() · signinProviderDetails() · websiteSigninProviderDetails() · getSigninProvidersFn() · getWebsiteSigninProvidersFn() · esMappingsController() · cacheBuilder() · getCacheValue(String cacheName, String key, Callable<Object> loader) · addEventListener(String eventType, boolean enabled, Object function) · addEventListenerForType(String eventClassName, boolean enabled, Object function) · setUserTimelineFunction(Object func) · setOrgTimelineFunction(Object func) · call(String execFn, Object args) · callWithThrow(String execFn, Object args) · getAppName() · getRepoName() · getPaymentProviderDetails() · getSmsProviderDetails() · getEmailSenderDetails() · executeJs(Object func, Object args) · getRoles() · triggerEvent(String eventDefId, Map<String,Object> eventProperties) · newEventDefinitionBuilder(String id) · addReport(String pathToJsonFile) · addReport(String reportId, String title, String description, String reportTemplate, String function, String attachmentContentType, String attachmentExtension) · addReport(String reportId, String title, String description, String reportTemplate, VarArgFunction functionPtr, String attachmentContentType, String attachmentExtension) · addQueryTableReport(String reportId, String title, String description, String reportTemplate, String queryTableId, String attachmentContentType, String attachmentExtension) · getReports() · getNodeTypes() · getJourneyFields() · getJourneyFieldsFunction() · journeyFieldsFunction(Object fn) · repoAppPaymentResult() · getComponents() · getRepoAppSettings() · getQueries() · getCheckoutRuleTypes() · getPromotionMechanicTypes() · getPointsRuleTypes() · getPointsExpiryRuleTypes()

getHash()

Returns: String

Git style content hash of the app repository branch that this mapping list was built from. Used to look up the app's file contents through the data session manager.

findHash(String path)

Returns: String

Looks up the content hash of a single file or directory inside the app's repository at the given path. Reads the app's data session, so it hits the blob store rather than being a plain field read.

ParameterDescription
pathpath within the app repository, for example /theme/page.html

listFiles(String path)

Returns: Map<String,String>

Lists the files in one directory of the app's repository, returning file name to content hash. Ordering is not preserved and sub directories are not included. Reads the app's data session, so it is not a cheap field access.

ParameterDescription
pathpath of the directory within the app repository

getRecipe()

Returns: Recipe

Recipe declared by the app, describing the ordered stages and steps used to configure the app after it is enabled.

getQueryTables()

Returns: List<RepoQueryTableDef>

Query table definitions registered by the app through addTableDef. A query table exposes a JavaScript function as a tabular data source that reports and the admin UI can select from.

getBuiltTables()

Returns: List<Table>

Join tables built by the app through addJoinTable. These are the concrete table objects registered with the query subsystem.

promotionMechanicTypeBuilder(String id, String title)

Returns: PromotionMechanicTypeBuilder

Starts building a promotion mechanic type contributed by this app. Set the templates and function names on the returned builder and then call build to register the mechanic so it can be selected when configuring a promotion.

ParameterDescription
idunique identifier for the mechanic type, stored against promotions that use it
titlehuman readable name shown when choosing a mechanic type

templateDefBuilder(String path, String name)

Returns: TemplateDefBuilder

Starts building a page template definition contributed by this app. Set the title, page type and editor on the returned builder and then call build to add the template to the list of templates content editors can choose from.

ParameterDescription
pathrepository path of the template file, for example /theme/mypage.html
namethe template name, used as its identifier

pointsRuleTypeBuilder(String id, String title)

Returns: PointsRuleTypeBuilder

Starts building a points rule type contributed by this app. Set the include and process function names and any configuration fields on the returned builder, then call build to register the rule type for use in points programmes.

ParameterDescription
idunique identifier for the points rule type
titlehuman readable name shown when choosing a rule type

pointsExpiryRuleTypeBuilder(String id, String title)

Returns: PointsExpiryRuleTypeBuilder

Starts building a points expiry rule type contributed by this app, which decides when accrued points expire. Call build on the returned builder to register it.

ParameterDescription
idunique identifier for the points expiry rule type
titlehuman readable name shown when choosing an expiry rule type

checkoutRuleTypeBuilder(String id, String title)

Returns: CheckoutRuleTypeBuilder

Starts building a custom shopping cart checkout rule type contributed by this app. Checkout rules can validate the cart items and take part in processing the checkout. Call build on the returned builder to register the rule type.

ParameterDescription
idunique identifier for the checkout rule type
titlehuman readable name shown when choosing a checkout rule type

indexQueryActionTypeBuilder(String id, String title)

Returns: IndexQueryActionTypeBuilder

Deprecated no-op, retained for backwards compatibility with apps that still call it. Use the implementation builder for indexQueryActionTypes instead.

ParameterDescription
idunique identifier for the action type, ignored
titlehuman readable name for the action type, ignored

getIndexQueryActionTypes()

Returns: List<IndexQueryActionType>

Deprecated no-op, retained for backwards compatibility with apps that still call it. Always returns null, because index query action types are now registered through the implementation builder for indexQueryActionTypes.

getFunnelTriggerTypes()

Returns: List<FunnelTriggerType>

Funnel trigger types registered by this app through addFunnelTriggerType. A funnel trigger type defines an event that can start or advance an automation.

addFunnelTriggerType(String id, String title, String eventId)

Returns: FunnelTriggerTypeBuilder

Starts building a funnel trigger type that fires on the given app event, adding it to this app's own list of trigger types. Configure the returned builder and call build to register it.

ParameterDescription
idunique identifier for the trigger type
titlehuman readable name shown when choosing a trigger
eventIdidentifier of the event that fires this trigger

addFunnelTriggerType(String id, String title, String eventId, List<FunnelTriggerType> list)

Returns: FunnelTriggerTypeBuilder

Starts building a funnel trigger type that fires on the given app event, adding it to the supplied list rather than to this app's own list. Used when trigger types are produced dynamically by a funnel trigger types function.

ParameterDescription
idunique identifier for the trigger type
titlehuman readable name shown when choosing a trigger
eventIdidentifier of the event that fires this trigger
listthe list the built trigger type is added to

funnelTriggerTypesFunction(Object fn)

Returns: ControllerMappingList

Registers a JavaScript function that produces funnel trigger types on demand instead of declaring them statically at load time. The function is called with the list to add trigger types to.

ParameterDescription
fnthe JavaScript function that populates the trigger type list

getFunnelTriggerTypesFunction()

Returns: Object

JavaScript function registered by funnelTriggerTypesFunction that builds funnel trigger types on demand.

getFunnelActionTypes()

Returns: List<FunnelActionType>

Funnel action types registered by this app through addFunnelActionType. A funnel action type is a step an automation can perform when it runs.

addFunnelActionType(String id, String title)

Returns: FunnelActionTypeBuilder

Starts building a funnel action type, adding it to this app's own list of action types. Configure the returned builder with the function that performs the action and call build to register it.

ParameterDescription
idunique identifier for the action type
titlehuman readable name shown when choosing an action

addFunnelActionType(String id, String title, List<FunnelActionType> actionTypes)

Returns: FunnelActionTypeBuilder

Starts building a funnel action type, adding it to the supplied list rather than this app's own list. Used when action types are produced dynamically by a funnel action types function.

ParameterDescription
idunique identifier for the action type
titlehuman readable name shown when choosing an action
actionTypesthe list the built action type is added to

funnelActionTypesFunction(Object fn)

Returns: ControllerMappingList

Registers a JavaScript function that produces funnel action types on demand instead of declaring them statically at load time. The function is called with the list to add action types to.

ParameterDescription
fnthe JavaScript function that populates the action type list

getFunnelActionTypesFunction()

Returns: Object

JavaScript function registered by funnelActionTypesFunction that builds funnel action types on demand.

getCaptchaVerifyFn()

Returns: String

Name of the JavaScript function this app provides to verify a captcha response, as registered by the captcha method. Its presence is what marks the app as a captcha provider.

captcha(String captchaVerifyFn, String portletTemplate, String portletInitFunction)

Returns: void

Registers this app as a captcha provider. Records the verification function name and also registers a website portlet in the captcha section that renders the captcha UI from the given template.

ParameterDescription
captchaVerifyFnname of the function that verifies a submitted captcha response
portletTemplaterepository path of the template that renders the captcha UI
portletInitFunctionoptional name of a function called before the portlet is rendered, may be null

addQuery(String path, List<String> indexNames, List<String> roleNames)

Returns: void

Registers a saved search query held as a JSON file in the app repository, so it appears in the query picker under the file's name. Reads the file contents at registration time and logs a warning if it is missing. Does nothing once the app's engine has finished initialising.

ParameterDescription
pathrepository path of the JSON query definition file
indexNamesnames of the search indexes the query can be run against, may be null
roleNamesnames of the roles a user must hold to run the query, may be null for no restriction

addTableDef(String id, String desc, String functionName)

Returns: RepoQueryTableDef

Registers a query table backed by a JavaScript function, making the function's rows available to reports and the admin table views. Chain addHeader calls on the returned definition to declare the column headings. See the query table tutorial in the Kademi developer documentation for a worked example.

ParameterDescription
idunique identifier for the table
deschuman readable name for the table, shown when choosing a data source
functionNamename of the global JavaScript function that loads the rows

addTableDef(String id, String desc, String functionName, String headersFnName)

Returns: RepoQueryTableDef

Registers a query table backed by a JavaScript function, with a second function supplying the column headings instead of them being declared statically. Use this when the columns depend on account configuration.

ParameterDescription
idunique identifier for the table
deschuman readable name for the table, shown when choosing a data source
functionNamename of the global JavaScript function that loads the rows
headersFnNamename of the global JavaScript function that returns the column headings

joinTableBuilder()

Returns: JoinTableBuilder

Starts building a join table, which combines several existing tables into one queryable table. Pass the configured builder to addJoinTable to register the result.

addJoinTable(JoinTableBuilder b)

Returns: JoinTable

Builds the join table described by the given builder and registers it against this app so it can be queried and reported on. The table is still built and returned once the engine has initialised, but it is no longer added to the app's list.

ParameterDescription
bthe configured join table builder

addTemplate(String parentPath, String fileName, String description, boolean contentTemplate)

Returns: ControllerMappingList

Registers a page template held in the app repository so that content editors can use it. Does nothing once the app's engine has finished initialising.

ParameterDescription
parentPathabsolute path to the folder containing the template
fileNamethe template file name without its suffix
descriptiona meaningful description of the template, shown when choosing one
contentTemplatetrue to let users create new pages with this template

addEdmTemplate(String parentPath, String fileName, String description, boolean contentTemplate)

Returns: ControllerMappingList

Registers an email template held in the app repository, the same as addTemplate except the template is opened with the EDM editor and is backed by a dummy EDM resource rather than a website page.

ParameterDescription
parentPathabsolute path to the folder containing the template
fileNamethe template file name without its suffix
descriptiona meaningful description of the template, shown when choosing one
contentTemplatetrue to let users create new emails with this template

addNodeType(String name, String template)

Returns: ControllerMappingList

Registers a plain journey node type rendered from the given template. Use addActionNodeType or addGoalNodeType instead when the node needs to run JavaScript.

ParameterDescription
nameunique name of the node type, shown in the journey editor
templaterepository path of the template that renders the node's configuration UI

addActionNodeType(String name, String template, String jsMethod)

Returns: ControllerMappingList

Registers a journey action node type. When a lead reaches a node of this type the named JavaScript function is run to perform the action.

ParameterDescription
nameunique name of the node type, shown in the journey editor
templaterepository path of the template that renders the node's configuration UI
jsMethodname of the global JavaScript function that performs the action

addGoalNodeType(String name, String jsTemplate, String jsMethod)

Returns: ControllerMappingList

Registers a journey goal node type. The named JavaScript function is evaluated to decide whether a lead has met the goal and so may pass the node.

ParameterDescription
nameunique name of the node type, shown in the journey editor
jsTemplaterepository path of the template that renders the node's configuration UI
jsMethodname of the global JavaScript function that decides whether the goal is met

addGoalNodeType(String name, String jsTemplate, String jsMethod, String jsOnEnterMethod)

Returns: ControllerMappingList

Registers a journey goal node type with an additional function that runs when a lead enters the node. Use the on enter function for work that needs a resolved lead, because the match function is also evaluated with a null lead while journey entry criteria are being checked.

ParameterDescription
nameunique name of the node type, shown in the journey editor
jsTemplaterepository path of the template that renders the node's configuration UI
jsMethodname of the global JavaScript function that decides whether the goal is met
jsOnEnterMethodoptional name of a function called when the node is entered with a resolved lead, including on the very first node of a newly created lead

addEngagementScoringFactorType(String id, String label, Object getProperties, Object findEngagementDatesFn)

Returns: ControllerMappingList

Registers an engagement scoring factor type, which contributes dates of engagement activity to a lead's engagement score. Both arguments may be given either as a function name or as an actual JavaScript function. Does nothing once the app's engine has finished initialising.

ParameterDescription
idunique identifier for the scoring factor type
labelhuman readable name shown when configuring engagement scoring
getPropertiesfunction returning the configurable properties of the factor
findEngagementDatesFnfunction returning the dates on which the lead engaged

getEngagementScoringFactorType()

Returns: List<EngagementScoringFactorType>

Engagement scoring factor types registered by this app through addEngagementScoringFactorType.

newTableActionHandlerBuilder()

Returns: JsTableActionHandlerBuilder

Starts building a table action handler, which is a named action offered against the rows of an uploaded data table. Configure the returned builder and call its build method to register the handler.

getTableActionHandlers()

Returns: List<TableActionHandler>

Table action handlers registered by this app through newTableActionHandlerBuilder.

newMetricTypeBuilder()

Returns: JsMetricTypeBuilder

Starts building a metric type, which defines a measure this app contributes to reporting and dashboards. Configure the returned builder and call its build method to register the metric type.

getMetricTypes()

Returns: List<MetricType>

Metric types registered by this app through newMetricTypeBuilder. The list is made immutable once the app has initialised.

addJourneyField(String id, String label, String type, String input, List<String> operators, Object evalFunction)

Returns: ControllerMappingList

Registers a version one journey field, which can be used as a condition when segmenting profiles or building journeys. New apps should prefer newFieldBuilder, which produces the version two fields. Throws if the eval function is neither a function name nor a callable function.

ParameterDescription
idunique identifier for this field, which must be unique across all apps
labela user friendly label shown in the condition editor
typeone of string, integer, double, date, time, datetime or boolean
inputradio, or null for the default input. To use a select box call addJourneyFieldSelect instead
operatorsthe comparison operators the field allows
evalFunctioneither the name of a function or an actual function, evaluated to produce the field value

addNumericJourneyField(String id, String label, boolean integer, Object evalFunction)

Returns: ControllerMappingList

Registers a numeric version one journey field, using the standard numeric comparison operators. Throws if the eval function is neither a function name nor a callable function.

ParameterDescription
idunique identifier for this field, which must be unique across all apps
labela user friendly label shown in the condition editor
integertrue for a whole number field, false for a decimal one
evalFunctioneither the name of a function or an actual function, evaluated to produce the field value

addTextJourneyField(String id, String label, Object evalFunction)

Returns: ControllerMappingList

Registers a text version one journey field on this app, using the standard text comparison operators.

ParameterDescription
idunique identifier for this field, which must be unique across all apps
labela user friendly label shown in the condition editor
evalFunctioneither the name of a function or an actual function, evaluated to produce the field value

addTextJourneyField(String id, String label, Object evalFunction, List<Field> fields)

Returns: ControllerMappingList

Registers a text version one journey field into the supplied field list rather than this app's own list. Used when fields are produced dynamically by a journey fields function. Throws if the eval function is neither a function name nor a callable function.

ParameterDescription
idunique identifier for this field, which must be unique across all apps
labela user friendly label shown in the condition editor
evalFunctioneither the name of a function or an actual function, evaluated to produce the field value
fieldsthe list the built field is added to

addFieldV2(String id, String label, String returnType, Object parentTypes, Object evalFunction)

Returns: ControllerMappingList

Registers a version two field in one call, which is a shorthand for configuring a field builder and building it. Version two fields are typed and can hang off a parent type, so they can be chained in queries.

ParameterDescription
idunique identifier for this field, which must be unique across all apps
labela user friendly label shown in the condition editor
returnTypeone of datetime, string, integer, boolean or double, or the name of an object type such as Profile or Lead
parentTypesthe type or types this field hangs off, given as a list, an array or a single string, or null for a root field
evalFunctioneither the name of a function or an actual function, evaluated to produce the field value

newFieldBuilder(String id, String label)

Returns: FieldV2Builder

Starts building a version two field on this app. Chain the returned builder's methods to configure the field and then call build to create and register it.

ParameterDescription
idunique identifier for this field, which must be unique across all apps
labela user friendly label shown in the condition editor

addFieldV2(String id, String label, String returnType, Object parentTypes, Object evalFunction, List<Field> fields)

Returns: ControllerMappingList

Registers a version two field into the supplied field list rather than this app's own list. Note that only the identifier and label are carried through to the built field by this overload.

ParameterDescription
idunique identifier for this field, which must be unique across all apps
labela user friendly label shown in the condition editor
returnTypeone of datetime, string, integer, boolean or double, or the name of an object type such as Profile or Lead
parentTypesthe type or types this field hangs off, given as a list, an array or a single string, or null for a root field
evalFunctioneither the name of a function or an actual function, evaluated to produce the field value
fieldsthe list the built field is added to

addJourneyFieldSelect(String id, String label, String type, List<String> values, List<String> operators, Object evalFunction)

Returns: ControllerMappingList

Registers a version one journey field rendered as a select box with a fixed list of values, added to this app's field list.

ParameterDescription
idunique identifier for this field, which must be unique across all apps
labela user friendly label shown in the condition editor
typeone of string, integer, double, date, time, datetime or boolean
valuesthe values offered in the select box
operatorsthe comparison operators the field allows
evalFunctioneither the name of a function or an actual function, evaluated to produce the field value

addJourneyFieldSelect(String id, String label, String type, List<String> values, List<String> operators, Object evalFunction, List<Field> fields)

Returns: ControllerMappingList

Registers a version one select journey field into the supplied field list rather than this app's own list. Used when fields are produced dynamically by a journey fields function. Throws if the eval function is neither a function name nor a callable function.

ParameterDescription
idunique identifier for this field, which must be unique across all apps
labela user friendly label shown in the condition editor
typeone of string, integer, double, date, time, datetime or boolean
valuesthe values offered in the select box
operatorsthe comparison operators the field allows
evalFunctioneither the name of a function or an actual function, evaluated to produce the field value
fieldsthe list the built field is added to

addComponent(String compId, String type, String desc, String jsFile, String editorHtml, String previewImage, String renderTemplate, String settingsTemplate)

Returns: ControllerMappingList

Registers a KEditor component with every path given explicitly. A component is a drag and drop block that content editors can place on a page. Does nothing once the app's engine has finished initialising.

ParameterDescription
compIdglobally unique identifier for the component
typethe resource type this component applies to, matched with the resource's is method
desca user friendly description shown in the component picker
jsFilepath of the client side script that initialises the component editor
editorHtmlthe HTML inserted into the content editor when the component is dropped in, later replaced by the rendered output
previewImagepath of the image shown for the component in the content editor
renderTemplatepath of the template that renders the component with live data
settingsTemplatepath of the template that renders the component's settings panel

addComponent(String compId, String type, String desc, String categories, String jsFile, String editorHtml, String previewImage, String renderTemplate, String settingsTemplate)

Returns: ControllerMappingList

Registers a KEditor component with every path given explicitly, and with categories that group it in the component picker. Does nothing once the app's engine has finished initialising.

ParameterDescription
compIdglobally unique identifier for the component
typethe resource type this component applies to, matched with the resource's is method
desca user friendly description shown in the component picker
categoriescomma separated categories or tags used to group the component
jsFilepath of the client side script that initialises the component editor
editorHtmlthe HTML inserted into the content editor when the component is dropped in, later replaced by the rendered output
previewImagepath of the image shown for the component in the content editor
renderTemplatepath of the template that renders the component with live data
settingsTemplatepath of the template that renders the component's settings panel

addComponent(String appId, String compId, String type, String desc)

Returns: ControllerMappingList

Registers a KEditor component using the standard file naming convention, so the script, templates and preview image paths are derived from the app identifier and component identifier. The simplest way to add a component with a single type and default options.

ParameterDescription
appIdthe app path the component's files live under, normally the app name
compIdglobally unique identifier for the component, and the base name of its files
typethe resource type this component applies to
desca user friendly description shown in the component picker

addComponent(String appId, String compId, String type, String desc, String categories)

Returns: ControllerMappingList

Registers a KEditor component using the standard file naming convention, with categories that group it in the component picker.

ParameterDescription
appIdthe app path the component's files live under, normally the app name
compIdglobally unique identifier for the component, and the base name of its files
typethe resource type this component applies to
desca user friendly description shown in the component picker
categoriescomma separated categories or tags used to group the component

addComponent(String appId, String compId, List<String> types, String desc, String categories)

Returns: ControllerMappingList

Registers a KEditor component using the standard file naming convention, applying to several resource types rather than one.

ParameterDescription
appIdthe app path the component's files live under, normally the app name
compIdglobally unique identifier for the component, and the base name of its files
typesthe resource types this component applies to, may be null
desca user friendly description shown in the component picker
categoriescomma separated categories or tags used to group the component

addComponent(String appId, String compId)

Returns: ComponentBuilder

Starts building a KEditor component. Use this overload when the component needs several types, categories or default attributes; call build on the returned builder to register it.

ParameterDescription
appIdthe app path the component's files live under, normally the app name
compIdglobally unique identifier for the component, and the base name of its files

browseResourcesFunction(Object fn)

Returns: ControllerMappingList

Registers a function that lists the app's own resources for a given website path, so they appear in resource browsers such as the link picker. The function is called with the website root folder, the path and the list to add resource beans to.

ParameterDescription
fnthe JavaScript function that populates the resource list

getBrowseResourcesFunction()

Returns: Object

Function registered by browseResourcesFunction that lists the app's resources when a website path is browsed.

appIndexersFunction(Object fn)

Returns: ControllerMappingList

Registers a function returning the app indexers this app contributes, which are what feed the app's own data into the search index. The function is called with no arguments and must return a list of indexers.

ParameterDescription
fnthe JavaScript function that returns the list of app indexers

getAppIndexersFunction()

Returns: Object

Function registered by appIndexersFunction that returns this app's search indexers. Whether it is present is cached per account, so apps without indexers are not initialised unnecessarily.

appendConfigFunction(Object fn)

Returns: ControllerMappingList

Registers a function that describes this app's configuration items, so they can be exported and compared between accounts. The function is called with a config item list builder to add entries to.

ParameterDescription
fnthe JavaScript function that appends configuration items

getAppendConfigFunction()

Returns: Object

Function registered by appendConfigFunction that lists this app's configuration items. It is called with a config item list builder, for example function myConfigAppender(configBuilder) that builds a properties map per item and calls configBuilder.add with the item name, type and properties.

applyConfigFunction(Object fn)

Returns: ControllerMappingList

Registers a function that applies configuration changes to this app, which is what makes the app's config importable. Without it the platform reports that the app cannot apply config changes. The function is called with the config deltas and an apply context.

ParameterDescription
fnthe JavaScript function that applies configuration changes

getApplyConfigFunction()

Returns: Object

Function registered by applyConfigFunction that applies imported configuration changes to this app.

getAutoApplyTypeIds()

Returns: List<String>

Configuration item type identifiers this app is willing to have applied automatically, rather than only on an explicit import.

getList()

Returns: List<ControllerMapping>

Website controller mappings registered by this app, the same list returned by getWebsiteMappings.

getSources()

Returns: List<String>

Paths of the JavaScript source files the app loads into its engine, in the order they are declared in controllers.xml.

getMenus()

Returns: List<AppMenuItem>

Admin menu items this app adds, as declared by the menu elements in controllers.xml.

getInitDate()

Returns: Date

Time at which the app's engine was last initialised. Useful for telling whether a deployed change has been picked up.

getInitError()

Returns: Exception

Exception that stopped the app's engine from initialising, most often a JavaScript syntax or load error. When this is set the app is loaded but non functional.

getInitLogs()

Returns: List<String>

Log lines captured while the app's engine was being initialised, used to show load time messages in the app admin screens.

getEngine()

Returns: KademiScriptEngine

Script engine the app's JavaScript runs in, created during initialisation from the app's sources and engine version.

getOnAppUpdated()

Returns: String

Name of the function called when the app is updated to a new version, as declared by the onAppUpdated attribute in controllers.xml.

getOnAppEnabled()

Returns: String

Name of the function called when the app is enabled on an account, as declared by the onAppEnabled attribute in controllers.xml.

getOnAppDisabled()

Returns: String

Name of the function called when the app is disabled on an account, as declared by the onAppDisabled attribute in controllers.xml.

getWebsiteMappings()

Returns: List<ControllerMapping>

Controller mappings this app serves on website root folders, each binding a URL pattern to a JavaScript function and template.

getAdminMappings()

Returns: List<ControllerMapping>

Controller mappings this app serves in the admin console, each binding a URL pattern to a JavaScript function and template.

getAdminPortletMappings()

Returns: List<PortletMapping>

Portlets this app contributes to admin pages. A portlet mapping names the page section it renders into and the function and template used to render it.

getTemplates()

Returns: List<TemplateDef>

Page and email templates this app makes available to content editors, registered through addTemplate and addEdmTemplate.

getWebsitePortletMappings()

Returns: List<PortletMapping>

Portlets this app contributes to website pages, including the captcha portlet registered by the captcha method.

getProfileTabMappings()

Returns: List<ProfileTabMapping>

Extra tabs and summary panels this app adds to the admin profile page, registered through adminProfileTab.

getOrgTabMappings()

Returns: List<ProfileTabMapping>

Extra tabs and summary panels this app adds to the admin organisation page, registered through adminOrgTab.

getTriggerTypeMappings()

Returns: List<TriggerTypeMapping>

Legacy automation trigger types registered through automationTrigger. New apps should register funnel trigger types with addFunnelTriggerType instead.

getSigninProviderMappings()

Returns: List<RepoSigninProviderBean>

Admin sign in providers this app contributes, such as an external identity provider offered on the admin sign in page.

getWebsiteSigninProviderMappings()

Returns: List<RepoSigninProviderBean>

Website sign in providers this app contributes, offered on website sign in pages rather than the admin console.

getEventListeners()

Returns: List<RepoAppEventListener>

Event listeners this app has registered through addEventListener and addEventListenerForType. Each pairs an event type or class with the function to run.

getProfileTimelineMapping()

Returns: ProfileTimelineMapping

Function this app contributes to the user timeline, registered through setUserTimelineFunction. It is called to add stream items to a profile's timeline.

getOrgTimelineMapping()

Returns: ProfileTimelineMapping

Function this app contributes to the organisation timeline, registered through setOrgTimelineFunction.

getJsServices()

Returns: Map<String,JsService>

Named JavaScript services this app publishes for other apps to call, keyed by service name. Created on first access, so this never returns null.

newServiceBuilder(String serviceName)

Returns: JsServiceBuilder

Starts building a named JavaScript service that other apps can call. Set the service object on the returned builder and call build to publish it under the given name.

ParameterDescription
serviceNamethe name other apps will look the service up by

getJsImplementations()

Returns: Map<String,JsImplementation>

Implementations this app supplies for named extension points, keyed by interface name. Created on first access, so this never returns null.

newImplementationBuilder(String interfaceName)

Returns: JsImplementationBuilder

Starts building an implementation of a named extension point, which is the current way to plug into platform hooks such as index query action types. Set the implementation object on the returned builder and call build.

ParameterDescription
interfaceNamename of the extension point being implemented

getDynamicIdpPaths(String type)

Returns: List<String>

Paths this app declares as dynamic identity provider endpoints for the given provider type, registered through the dynamic IDP paths builder.

ParameterDescription
typethe identity provider type to look up

getWebsocketMapping(String type)

Returns: RepoAppWebsocketMapping

Websocket handler this app registered for the given channel type through the websocket controller.

ParameterDescription
typethe websocket channel type to look up

getSseMapping(String type)

Returns: RepoAppSseMapping

Server sent events handler this app registered for the given stream type through the SSE controller.

ParameterDescription
typethe event stream type to look up

getWebsiteMcpMapping(String type)

Returns: RepoAppMcpMapping

MCP server this app registered for the given type on the website side, which is what exposes the app's tools to AI clients on public websites.

ParameterDescription
typethe MCP server type to look up

getAdminMcpMapping(String type)

Returns: RepoAppMcpMapping

MCP server this app registered for the given type on the admin side, which is what exposes the app's tools to AI clients in the admin console.

ParameterDescription
typethe MCP server type to look up

getAuthenticationHandlerMappings()

Returns: List<JsAuthHandlerMapping>

Custom authentication handlers this app registered through the authentication handler builder.

getMailboxMappings()

Returns: List<MailboxMapping>

Mailbox handlers this app registered through the mailbox controller, each binding an inbound email address pattern to a function. Created on first access, so this never returns null.

getMenuMappings()

Returns: List<MenuMapping>

Menu handlers this app registered through the menu controller, which let the app contribute items to menus at runtime. Created on first access, so this never returns null.

paymentProviderDetails()

Returns: PaymentProviderDetailsBuilder

Starts building the payment provider details for this app, which is what registers it as a payment provider for shopping carts. Set the function names and payment form on the returned builder and call build.

smsProviderDetails()

Returns: SmsProviderDetailsBuilder

Starts building the SMS provider details for this app, which is what registers it as a provider for sending text messages. Set the properties on the returned builder and call build.

emailSenderDetails()

Returns: EmailSenderDetailsBuilder

Starts building the email sender details for this app, which is what registers it as an email sending app. Set the properties on the returned builder and call build.

adminController()

Returns: ControllerMappingBuilder

Starts building an admin controller, which binds a URL pattern under the admin console to a JavaScript function and a template. Call build on the returned builder to register it.

websiteController()

Returns: ControllerMappingBuilder

Starts building a website controller, which binds a URL pattern on a public website to a JavaScript function and a template. Call build on the returned builder to register it.

adminPortletController()

Returns: PortletMappingBuilder

Starts building an admin portlet, which renders extra content into a named section of an admin page. Call build on the returned builder to register it.

websitePortletController()

Returns: PortletMappingBuilder

Starts building a website portlet, which renders extra content into a named section of a website page. Call build on the returned builder to register it.

websocketController()

Returns: WebsocketMappingBuilder

Starts building a websocket handler, which lets the app receive and send messages on a named websocket channel. Call build on the returned builder to register it.

dynamicIdpPaths()

Returns: IdpDynamicPathsBuilder

Starts declaring dynamic identity provider paths for this app, so that requests to those paths are handled by the named provider type. Set the type and paths on the returned builder and call build.

sseController()

Returns: SseMappingBuilder

Starts building a server sent events handler, which lets the app push a stream of events to a connected browser. Call build on the returned builder to register it.

websiteMcpController()

Returns: McpMappingBuilder

Starts building an MCP server exposed on the website side, which publishes the app's tools to AI clients on public websites. Call build on the returned builder to register it.

adminMcpController()

Returns: McpMappingBuilder

Starts building an MCP server exposed on the admin side, which publishes the app's tools to AI clients in the admin console. Call build on the returned builder to register it.

authenticationHandler()

Returns: AuthHandlerBuilder

Starts building a custom authentication handler, letting the app authenticate requests itself rather than relying on the built in mechanisms. Call build on the returned builder to register it.

adminProfileTab()

Returns: ProfileTabsBuilder

Starts building an extra tab, and optionally a summary panel, on the admin profile page. Set the title, portlet id and rendering function on the returned builder and call build.

adminOrgTab()

Returns: ProfileTabsBuilder

Starts building an extra tab, and optionally a summary panel, on the admin organisation page.

mailboxController()

Returns: MailboxMappingBuilder

Starts building a mailbox handler, so the app can process inbound email delivered to a matching address. Call build on the returned builder to register it.

Returns: MenuMappingBuilder

Starts building a menu handler, so the app can contribute or modify menu items at runtime rather than declaring them statically in controllers.xml. Call build on the returned builder to register it.

automationTrigger()

Returns: TriggerTypeBuilder

Starts building a legacy automation trigger type. New apps should use addFunnelTriggerType instead.

signinProvider()

Returns: SigninProviderBuilder

Starts building an admin sign in provider, which adds an alternative way to sign in to the admin console. Call build on the returned builder to register it.

websiteSigninProvider()

Returns: SigninProviderBuilder

Starts building a website sign in provider, which adds an alternative way to sign in to a public website.

signinProviderDetails()

Returns: SigninProviderDetailsBuilder

Starts building the admin sign in provider details for this app, where the provider list is produced by a function instead of being declared statically. Call build on the returned builder to register the function.

websiteSigninProviderDetails()

Returns: SigninProviderDetailsBuilder

Starts building the website sign in provider details for this app, where the provider list is produced by a function instead of being declared statically.

getSigninProvidersFn()

Returns: String

Name of the function that returns this app's admin sign in providers, as registered through signinProviderDetails.

getWebsiteSigninProvidersFn()

Returns: String

Name of the function that returns this app's website sign in providers, as registered through websiteSigninProviderDetails.

esMappingsController()

Returns: RepoEsMappingsBuilder

Starts declaring Elasticsearch index mappings for a database this app owns, so its documents are indexed with the right field types. Call build on the returned builder to register them.

cacheBuilder()

Returns: CacheBuilder

Starts building a named cache scoped to this app and its current repository hash, so cached values are discarded when the app is updated. Call build on the returned builder to create the cache.

getCacheValue(String cacheName, String key, Callable<Object> loader)

Returns: Object

Reads a value from one of this app's caches, calling the loader to compute it on a miss. The load is performed while holding the script context lock, so a JavaScript loader can safely run on the app's engine.

ParameterDescription
cacheNamename of the cache, as given to the cache builder
keythe key to read within that cache
loadercalled to compute the value when it is not already cached

addEventListener(String eventType, boolean enabled, Object function)

Returns: ControllerMappingList

Registers a listener for platform and app events, matched by the event's simple class name or, for trigger and app events, by its event id. The listener function is called with the current root folder and the event. Duplicate registrations of the same type, flag and function are ignored.

ParameterDescription
eventTypesimple class name of the event, or the event id for a trigger or app event
enabledfalse to register the listener but leave it switched off
functionthe function to run, given either as a name or as an actual function

addEventListenerForType(String eventClassName, boolean enabled, Object function)

Returns: ControllerMappingList

Registers a listener against a fully qualified event class or interface, rather than a simple name. If the named type is an interface then every event implementing it is handled. Duplicate registrations are ignored.

ParameterDescription
eventClassNamefully qualified name of the event class or interface to listen for
enabledfalse to register the listener but leave it switched off
functionthe function to run, given either as a name or as an actual function

setUserTimelineFunction(Object func)

Returns: ControllerMappingList

Sets the function called when a profile's timeline is generated, so the app can add its own stream items to the timeline. The function is called with the page, the user and the list to add items to.

ParameterDescription
functhe timeline function, given either as a name or as an actual function

setOrgTimelineFunction(Object func)

Returns: ControllerMappingList

Sets the function called when an organisation's timeline is generated, so the app can add its own stream items to it. Works the same way as setUserTimelineFunction but for organisations.

ParameterDescription
functhe timeline function, given either as a name or as an actual function

call(String execFn, Object args)

Returns: Object

Calls a named function in the app's JavaScript engine and returns its result, yielding to the governor either side of the call so long running scripts can be interrupted. Returns null and logs a warning if the function does not exist or the engine failed to initialise.

ParameterDescription
execFnname of the global function to call
argsarguments passed to the function

callWithThrow(String execFn, Object args)

Returns: Object

Calls a named function in the app's JavaScript engine, the same as call except that failures are thrown rather than swallowed. Use it when the caller needs to know the call failed.

ParameterDescription
execFnname of the global function to call
argsarguments passed to the function

getAppName()

Returns: String

Name of the app this mapping list belongs to, as installed on the account, for example admin-lib.

getRepoName()

Returns: String

Name of the repository the app was loaded from. Set to the same value as the app name during initialisation.

getPaymentProviderDetails()

Returns: PaymentProviderDetails

Payment provider registration for this app, set by building payment provider details. Its presence is what marks the app as a payment provider for shopping carts.

getSmsProviderDetails()

Returns: SmsProviderDetails

SMS provider registration for this app, set by building SMS provider details. Its presence is what marks the app as able to send text messages.

getEmailSenderDetails()

Returns: EmailSenderDetails

Email sender registration for this app, set by building email sender details. Its presence is what marks the app as able to send email.

executeJs(Object func, Object args)

Returns: Object

Runs a function on the app's JavaScript engine, accepting either a function name or an actual callable function, and yields to the governor either side of the call. Script failures are logged with the app name and account and then rethrown as a runtime exception; a null or blank function simply returns null.

ParameterDescription
functhe function to run, given either as a name or as an actual callable function
argsarguments passed to the function

getRoles()

Returns: List<Role>

Security roles this app declares, combining both the original role declarations and the version two roles from controllers.xml. Builds a new list on each call.

triggerEvent(String eventDefId, Map<String,Object> eventProperties)

Returns: void

Fires an app event previously declared with newEventDefinitionBuilder, so that listeners in this and other apps can react to it. If no event definition matches the given id a warning is logged and nothing is fired.

ParameterDescription
eventDefIdid of the event definition to fire
eventPropertiesa map of string to object carrying the event's properties, passed on to listeners

newEventDefinitionBuilder(String id)

Returns: RepoAppEventDefBuilder

Starts declaring an event this app can raise, which other apps can then listen for with addEventListener. Use the chaining methods on the returned builder to set the event's properties and call build to register it.

ParameterDescription
idunique id for the event definition, which is also what triggerEvent is called with

addReport(String pathToJsonFile)

Returns: void

Registers a report defined by a JSON file in the app repository. The file is read and parsed when the app initialises, and a warning is logged if it is missing or cannot be parsed.

ParameterDescription
pathToJsonFilerepository path of the JSON report definition

addReport(String reportId, String title, String description, String reportTemplate, String function, String attachmentContentType, String attachmentExtension)

Returns: void

Registers a report rendered by a named JavaScript function and a template, optionally producing a downloadable attachment.

ParameterDescription
reportIdunique identifier for the report
titlehuman readable title shown in the report list
descriptiondescription shown alongside the title
reportTemplaterepository path of the template that renders the report
functionname of the global JavaScript function that produces the report data
attachmentContentTypecontent type of the generated attachment, or null for an on screen report
attachmentExtensionfile extension of the generated attachment, or null for an on screen report

addReport(String reportId, String title, String description, String reportTemplate, VarArgFunction functionPtr, String attachmentContentType, String attachmentExtension)

Returns: void

Registers a report rendered by an actual JavaScript function rather than a function name, which lets a closure be used.

ParameterDescription
reportIdunique identifier for the report
titlehuman readable title shown in the report list
descriptiondescription shown alongside the title
reportTemplaterepository path of the template that renders the report
functionPtrthe function that produces the report data
attachmentContentTypecontent type of the generated attachment, or null for an on screen report
attachmentExtensionfile extension of the generated attachment, or null for an on screen report

addQueryTableReport(String reportId, String title, String description, String reportTemplate, String queryTableId, String attachmentContentType, String attachmentExtension)

Returns: void

Registers a report whose rows come from a query table registered with addTableDef, rather than from a report function.

ParameterDescription
reportIdunique identifier for the report
titlehuman readable title shown in the report list
descriptiondescription shown alongside the title
reportTemplaterepository path of the template that renders the report
queryTableIdid of the query table supplying the report's rows
attachmentContentTypecontent type of the generated attachment, or null for an on screen report
attachmentExtensionfile extension of the generated attachment, or null for an on screen report

getReports()

Returns: List<Report>

Reports this app contributes, from both JSON report files and reports registered in JavaScript. The list is made immutable once the app has initialised.

getNodeTypes()

Returns: List<NodeTypeBean>

Journey node types this app contributes, registered through addNodeType, addActionNodeType and addGoalNodeType.

getJourneyFields()

Returns: List<Field>

Statically declared fields this app contributes for use in segments, journeys and queries. Dynamically produced fields come from the journey fields function instead.

getJourneyFieldsFunction()

Returns: Object

Function registered by journeyFieldsFunction that produces this app's fields dynamically.

journeyFieldsFunction(Object fn)

Returns: ControllerMappingList

Sets the function used to load this app's fields dynamically, given either as a closure or as a function name. It can be used instead of, or as well as, the statically declared fields added by the add field methods. The function is called with two arguments, the root folder and the field list to add to.

ParameterDescription
fnthe fields function, given either as a name or as an actual function

repoAppPaymentResult()

Returns: RepoAppPaymentResult

Creates an empty payment result for a payment provider app to populate and return from its processing function.

getComponents()

Returns: List<KEditorComponent>

KEditor components this app contributes, registered through the addComponent methods or declared as component elements in controllers.xml.

getRepoAppSettings()

Returns: List<RepoAppSettings>

Settings declarations for this app, from the settings elements in controllers.xml. They describe the configuration fields shown when an administrator sets the app up.

getQueries()

Returns: List<RepoAppQuery>

Saved search queries this app contributes, registered through addQuery from JSON files in the app repository.

getCheckoutRuleTypes()

Returns: List<RepoAppCustomCheckoutRuleType>

Custom shopping cart checkout rule types this app contributes, registered through the checkout rule type builder.

getPromotionMechanicTypes()

Returns: List<PromotionMechanicType>

Promotion mechanic types this app contributes, registered through the promotion mechanic type builder.

getPointsRuleTypes()

Returns: List<PointsRuleType>

Points rule types this app contributes, registered through the points rule type builder. These decide how points are awarded.

getPointsExpiryRuleTypes()

Returns: List<PointsExpiryRuleType>

Points expiry rule types this app contributes, registered through the points expiry rule type builder. These decide when awarded points expire.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.