NexJ Logo

Scheme API reference for NexJ CRM portal containers

The following Scheme APIs are available for use in NexJ CRM portal containers.

They are only accessible to developers building portlets in NexJ Studio

add-to-batch-requests

Adds a node to a list of ActiveNodes to query within one request. 

add-to-batch-requests parameters

ParameterValueDescription
controlleranyThe controller which contains the node.
nodeanyThe ActiveNode to query.
eventstringThe name of the event. Valid names are restricted to query or refresh.

Syntax

(add-to-batch-requests controller node event)

Example

(add-to-batch-requests this (@ view activeNode) "refresh")
(add-to-batch-requests this (@ view activeNode) "query")

context-form-source

Sets up a form to set the context to the OID of the current active instance whenever it changes.

context-form-source parameters

ParameterValueDescription
viewviewThe view.
varstringThe context variable name.
formstringThe form name.

Syntax

(context-form-source view var form)

Example

(context-form-source (this'view) "EntityId" "EntityList")

context-form-target

Sets up a form to listen to changes of a specific context variable.

context-form-target parameters

ParameterValueDescription
viewviewThe view.
varstringThe context variable name.
formstringThe form name.
associationstringThe association between the context variable and the form or a WHERE clause, in the following format (: association <value>) or (: whereFunc <value>).

Syntax

(context-form-target view var form association)

Example

(context-form-target (this'view) "EntityId" "EntityList" '(@@ Entity entityParticipations act))

context-get

Gets the current value of a given context variable. The signature must not change as the framework invokes the function.

context-get parameters

ParameterValueDescription
viewviewThe view.
varstringThe context variable name.

Returns

The context variable value.

Syntax

(context-get view var)

Example

(context-get (this'view) "Contact")

context-set

Sets context variable value. The signature must not change as the framework invokes the function.

ParameterValueDescription
viewviewThe view.
newValueslistThe list of pairs containing <variable, value> for each context variable to be set.

Syntax

(context-set view . newValues)

Example

(context-set (this'view) (cons "Contact" (inst'contactId)) (cons
   "Account" (inst'accountId)))

event-broadcast

Broadcasts an event so that sibling portlets and other portal container display groups are also notified of the event. The portlets will only receive the event if they are subscribed to an event with the same name.

event-broadcast parameters

ParameterValueDescription
namestringThe name of the event.
parameteranyThe parameter of the event.
viewviewThe source view of the event.

Syntax

(event-broadcast name parameter view)

Example

(event-broadcast "notifyAll" (message (:state "ready)) (this'view))

event-fire

Fires an event to the application broker portlet and the portal container.

event-fire parameters

ParameterValueDescription
namestringThe name of the event.
parameteranyThe parameter of the event.
viewviewThe source view of the event.

Syntax

(event-fire name parameter view)

Example

(event-fire "notifyAll" (message (:state "ready)) (this'view))

get-global-property

Gets the current value of a global property in the application.

get-global-property parameters

ParameterValueDescription
controllercontrollerThe current controller for the screen or form.
propNamestringThe name of the property.

Returns

The global property value.

Syntax

(get-global-property controller propName)

Example

(get-global-property this "CurrentContact")

navigate

Navigate to an existing workspace that contains the portlet specified by the view path with the option to pass context and event information.

navigate parameters

ParameterValueDescription
controllercontrollerThe controller for the portlet view.
viewPathlistThe view path to the target view as a list. The head of the view path is the name of the workspace. The tail of the view path is the name of the portlet reference. For example, (workspace1 portlet1) or (Person refEntityDetailPortlet).
contextlistList of context value pairs to set in the target workspace.
eventUIEventA UIEvent instance to fire on the target view.
fallbackViewPathslistA list of view paths to try in the order they are specified if the target view cannot be found.

Syntax

(navigate controller viewPath context event . fallbackViewPaths)

Example

(navigate this '(DockedEntity) (list (cons "EntityId" entityId)) () '(Person EntityNavigatorPortlet))
(navigate this '(Schedule TaskPortlet) () (UIEvent'new "sysRefresh" () (this'view))

portal-beacon-set-caption

Sets the displayed caption of a notification beacon, which appears on the portal container toolbar.

portal-beacon-set-caption parameters

ParameterValueDescription
controllercontrollerThe current controller.
sIdstringThe ID of the beacon.
captionstringThe new caption to set.

Syntax

(portal-beacon-set-caption controller sId sCaption)

Example

(portal-beacon-set-caption this "inbox" (number->string count))

portal-beacon-set-icon

Sets the displayed icon of a notification beacon, which appears on the portal container toolbar.

portal-beacon-set-icon parameters

ParameterValueDescription
portletViewviewThe current portlet view.
idstringThe ID of the beacon.
iconstringThe URL of the icon to display. If prependBaseURL is false, then the URL must be absolute.
prependBaseURLbooleanIndicates whether to prepend the icon URL with the calling portlet's group base URL. Values are #t and #f. If this parameter is not set to #t, the icon URL is expected to be an absolute URL.

Syntax

(portal-beacon-set-icon portletView id icon prependBaseURL)

Example

(portal-beacon-set-icon (this'view) "inbox" "/icons/16/note.png" #t)

portal-beacon-set-remote-method

Sets the SOA method to invoke when the specified notification beacon should update its value.

portal-beacon-set-remote-method parameters

ParameterValueDescription
controllercontrollerThe current controller.
sidstringThe ID of the beacon.
sRemoteMethodstring

The name of the SOA method.

Syntax

(portal-beacon-set-remote-method controller sId sRemoteMethod)

Example

(portal-beacon-set-remote-method this "inbox" "getInboxCount")

portal-beacon-set-visibility

Sets the visibility of a beacon.

portal-beacon-set-visibility parameters

ParameterValueDescription
controllercontrollerThe current controller.
sidstringThe ID of the beacon.
bVisiblebooleanThe new state of visibility for the beacon.

Syntax

(portal-beacon-set-visibility controller sId bVisible)

Example

(portal-beacon-set-visibility this "inbox" #t)

portal-toast-add-messages

Adds toast messages to the notification queue. Each message will be displayed sequentially.

portal-toast-add-messages parameters

ParameterValueDescription
portletViewviewThe current portlet view.
prependBaseURLbooleanIndicates whether to prepend each message icon URL with the calling portlet's group base URL. Values are #t and #f. If the value is #f, the message icon URL is expected to be an absolute URL.
messageListlistA list of toast messages. Each item is a message with the following parameters:
<msg>'iconstringThe icon URL. (Optional)
<msg>'textstringThe HTML markup to display in the toast message.
<msg>'eventstringThe name of the event to fire when the user clicks on toast message. (Optional)
<msg>'paramsanyThe parameters associated with the event when the user clicks on toast message. (Optional)

Syntax

(portal-toast-add-messages portletView prependBaseURL . messageList)

Example

(portal-toast-add-messages (this'view) #f msg)

portal-toast-set-enabled

Enables or disables the toast control.

portal-toast-set-enabled parameters

ParameterValueDescription
controllercontrollerThe current controller.
enabledbooleanIndicates whether to enable the toast control. Values are #t and #f.

Syntax

(portal-toast-set-enabled controller enabled)

Example

(portal-toast-set-enabled this #t)

portal-set-sidebar-visibility

Sets sidebar visibility.

portal-set-sidebar-visibility parameters

ParameterValueDescription
controllerScriptedControllerThe current controller.
sSidestringThe position of the sidebar. Options are: LEFT or RIGHT.
bVisiblebooleanIndicates whether this sidebar should be visible. Values are #t and #f.
sPortletRefNamestringThe name of the portlet reference. The portlet must also be referenced in the sidebar that belongs to this side of the screen. Optional if only only one portlet is defined for that screen side.

Syntax

(portal-set-sidebar-visibility controller sSide bvisible sPortletRefName)

Example

(portal-set-sidebar-visibility this "RIGHT" #t "conversationUserInboxPortlet")

set-global-property

Sets a global property in the application.

set-global-property parameters

ParameterValueDescription
controllercontrollerThe current controller for the screen or form.
propNamestringThe name of the property.
valueanyThe value to be set. The value should be something that can be serialized.

Syntax

(set-global-property controller propName value)

Example

(set-global-property this "CurrentContact"
  (unless (null? contact)
    (message (: :oid (contact':oid)) (: :class (contact':class)))
  )
)

workspace-close

Closes the workspace in which the portlet resides.

workspace-close parameters

ParameterValueDescription
portletViewviewThe view of the portlet.

Syntax

(workspace-close portletView)

Example

(workspace-close (this'view))

workspace-get-portlet-alias

Obtains a unique identifier for the calling portlet. The portlet alias can be used to differentiate instances of the same portlet within a workspace.

workspace-get-portlet-alias parameters

ParameterValueDescription
portletViewviewThe view of the portlet.

Returns

The portlet alias string. Null if the portletView is invalid.

Syntax

(workspace-get-portlet-alias portletView)

Example

(workspace-get-portlet-alias portletView)

workspace-is-docked

Determines if the workspace in which the portlet resides is a docked workspace.

workspace-is-docked parameters

ParameterValueDescription
portletViewviewThe portlet view corresponding to the portlet for which to check.

Returns

#t if portlet is currently in a docked workspace; #f otherwise.

Syntax

(workspace-is-docked portletView)

Example

(workspace-is-docked (this'view))

workspace-open

Opens a workspace or switches to a workspace if one matching the parameters is already open.

Opening a workspace has different behavior depending on which parameters are set. In all cases when searching for an opened workspace that matches the given parameters, if multiple workspaces matches the specified conditions, the workspace with the lowest ordinal number will open. Similarly, when opening a new workspace, the workspace template with the lowest ordinal that matches the specified conditions is used.

  • workspaceTemplate, var, context
    If all of these values are provided, then the current set of open workspaces is searched for an exact match of the three parameters. If a match is found, then it becomes the active workspace. If no match is found, then the portal framework will look for a workspace template configured with a workspace template name, context variable and open that workspace using the specified context value.
  • var, context
    If these two values are provided, then the current set of open workspaces is searched for any dynamic workspace that matches the context variable and value. If a match is found, then it becomes the active workspace. If no match is found, then the portal framework will look for a workspace template configured with a matching context variable and open that workspace using the specified context value.
  • workspaceTemplate
    If only the template name is provided, then the current set of open workspaces is searched for a workspace based on the specified template. If a match is found, then it becomes the active workspace. If no match is found, the system opens a new workspace making use of the template.

workspace-open parameters

ParameterValueDescription
controllercontrollerThe current controller for the workspace.
workspaceTemplatestringThe name of the workspace template to locate.
captionstringThe caption of the workspace layout.
iconstringThe URL of the workspace icon.
varstringThe context variable name.
contextstringThe context variable value.
wkspContextlistA context map for initializing the workspace.
argslist

A list of additional argument pairs.

To open a specific workspace, you can specify its OID, in the following format: (: workspace <oid>).

To persist client state for the docked workspace upon closing the workspace, specify (: persistDocked #t). The system will then re-use the state for docked workspaces that are opened with this argument and the same template name.

Syntax

(workspace-open controller workspaceTemplate caption icon var context wkspContext . args)

Example

(workspace-open this (model'name) () (model'icon) '() '() '() (: workspace (model':oid)))

workspace-open-app-perspective

Opens an application perspective.

workspace-open-app-perspective parameters

ParameterValueDescription
screenViewviewThe current portlet view, or workspace view.
portletLayoutRefNamestringThe name of the portlet layout reference which will hold the application perspective layout.
workspaceTemplatestringThe name of the workspace template to locate, to provide the layout definition.
captionstringThe caption of application perspective layout.
iconstringThe URL of the application perspective icon.
configslistTransfer objects representing application configuration data (application configuration ID, caption, and icon) (Optional)

Syntax

(workspace-open-app-perspective screenView portletLayoutRefName
workspaceTemplate caption icon . configs)

Example

(workspace-open-app-perspective(this'view) "appHolder" "ScheduleApplication" "AppHolder Caption" "./icons/16/appHolderIcon.png" ())

workspace-set-caption

Sets the caption of the workspace that the specified portlet view resides in.

workspace-set-caption parameters

ParameterValueDescription
portletViewviewThe view of the portlet.
captionstringThe caption string to set.

Syntax

(workspace-set-caption portletView caption)

Example

(workspace-set-caption (this'view) "Accounts")