Custom actions
In this chapter we cover the following topics:
Custom action example
Custom actions allow to open URLs that can be customized using data from the graph.
Custom actions allows a scenario such as:
- Given a
Company
node, the user right-clicks on a node and navigates toCustom actions
in the context menu. - The user clicks on the appropriate custom action (as there may be more than one). Here
Open in Salesforce
. - A new tab is open in the browser and displays the company's profile page in Salesforce.
Creating and managing custom actions
Accessing the custom actions panel
The panel can be accessed through the workspace, by opening the main menu and selecting "Manage custom actions ...".
The panel is available only to users who are authorized to create and manage Custom actions.
Managing custom actions
From the Custom actions panel, a user may:
- Create a new custom action.
- Edit or Delete custom actions they own.
- View the details of custom actions that they have access to.
Creating a custom action
In order to create a custom action a user:
- must give it a name (mandatory).
- must provide a URL Template (mandatory, see next section about the syntax).
- may provide a description.
- may share it with all users.
URL template syntax
A Custom action contains a URL template with one of more variables that are replaced by actual values provided by the context.
Example:
- Template:
https://google.com/?q={{node.first_name}}
- When running this custom action on a specific node, the
{{node.first_name}}
variable will be replaced by thefirst_name
property of the selected node.
The following variables can be used in a URL template:
- ID of the current node (e.g.
{{node}}
) - Property value of the current node (e.g.
{{node.first_name}}
) - ID of the current edge (e.g.
{{edge}}
) - Property value of the current edge (e.g.
{{edge.amount}}
) - ID of the current visualization (
{{visualization}}
) - ID of the current alert (
{{alert}}
) - ID of the current alert's case (
{{case}}
) - Context of the current page (
{{page}}
) - SourceKey of the current data-source (
{{sourceKey}}
) - Root URL of Linkurious Enterprise (
{{baseURL}}
) - List of IDs for currently selected nodes (e.g.
{{nodeset}}
) - List of IDs for currently selected edges(e.g.
{{edgeset}}
) - List of property-values for currently selected nodes (e.g.
{{nodeset.country}}
) - List of property-values for currently selected edges (e.g.
{{edgeset.currency}}
)
Several variables can be used in the same template
(e.g. https://google.com/search?q={{node.city}}+{{node.country}}
),
with the constraint that "node" and "edge" variables cannot be mixed.
Variables
Node ID
- Usage: insert the ID of the currently selected node in the URL template.
- Syntax:
{{node}}
By default, a custom action with a {{node}}
variable will be
available on all nodes. To make this custom action available only
for Company
nodes, use the following syntax: {{node:"Company"}}
.
If multiple "Node ID" variables (or "Node property" variables) are used in a single custom action, they need to all have the same node-category constraint (see example 3).
Examples:
https://example.com/details?node={{node}}
https://example.com/details?node={{node:"Person"}}
https://example.com/node?id={{node:"Person"}}&name={{(node:"Person").name}}
Node property
- Usage: insert the value of a property of the currently selected node in the URL template.
- Syntax:
{{node.property_name}}
or{{node."property name"}}
(if the property name contains spaces of special characters).
By default, a custom action with a {{node.property_name}}
variable
will be available on all nodes. To make this custom action available
only for Account
nodes, use the following syntax:
{{(node:"Account").property_name}}
.
If multiple "Node property" variables (or "Node ID" variables) are used in a single custom action, they need to all have the same node-category constraint (see example 4).
Examples:
https://google.com/search?q={{node.firstName}}
https://google.com/search?q={{node.firstName}}+{{node.lastName}}
https://google.com/search?q={{(node:"Person")."First name"}}
https://google.com/search?q={{(node:"Company").name}}+{{(node:"Company").city}}
Edge ID
- Usage: insert the ID of the currently selected edge in the URL template.
- Syntax:
{{edge}}
By default, a custom action with a {{edge}}
variable will be
available on all edge. To make this custom action available only for
Transaction
edge, use the following syntax: {{edge:"Transaction"}}
.
If multiple "Edge ID" variables (or "Edge property" variables) are used in a single custom action, they need to all have the same edge-type constraint (see example 3).
Examples:
https://example.com/edge_details?id={{edge}}
https://example.com/edge_details?id={{edge:"Transaction"}}
https://example.com/edge?id={{edge:"Transaction"}}&amount={{(edge:"Transaction").amount}}
Edge property
- Usage: insert the value of a property of the currently selected edge in the URL template.
- Syntax:
{{edge.property_name}}
or{{edge."property name"}}
(if the property name contains spaces of special characters).
By default, a custom action with a {{edge.property_name}}
variable
will be available on all edge. To make this custom action available only
for Transaction
edge, use the following syntax:
{{(edge:"Transaction").property_name}}
.
If multiple "Edge property" variables (or "Edge ID" variables) are used in a single custom action, they need to all have the same edge-type constraint (see example 5).
Examples:
https://google.com/search?q={{edge.amount}}
https://google.com/search?q={{edge.amount}}+{{edge.date}}
https://google.com/search?q={{(edge:"Transaction")."credit card"}}
https://google.com/search?q={{(edge:"Transaction").country}}+{{(edge:"Transaction").amount}}
Visualization ID
- Usage: insert the ID of the visualization in the URL template.
- Syntax:
{{visualization}}
A custom action with a {{visualization}}
variable will only be available in regular
visualizations (and not in the visualizations of alert's cases).
Examples:
https://example.com/details?viz={{visualization}}
https://example.com/details?viz={{visualization}}&node_id={{node}}
Alert ID
- Usage: insert the ID of the alert in the URL template.
- Syntax:
{{alert}}
A custom action with an {{alert}}
variable will only be available in the visualizations of
alert's cases (and not in regular visualizations).
Examples:
https://example.com/details?alert={{alert}}
https://example.com/details?alert={{alert}}&node_id={{node}}
Case ID
- Usage: insert the ID of the case in the URL template.
- Syntax:
{{case}}
A custom action with a {{case}}
variable will only be available in the visualizations of
alert's cases (and not in regular visualizations).
Examples:
https://example.com/details?case={{case}}
https://example.com/details?case={{case}}&alert={{alert}}&node_id={{node}}
Page
- Usage: insert the context of the current page in the URL template.
- Syntax:
{{page}}
When the custom action is executed, this variable is replaced by a URL-encoded JSON object with the following format:
- if the custom action is executed from a visualization:
{source:"visualization", visualizationId:739}
- if the custom action is executed from an alert's case:
{source:"alert", alertId:93, caseId:207}
Examples:
https://example.com/details?page={{page}}
https://example.com/details?page={{page}}&source={{sourceKey}}
SourceKey
- Usage: insert the SourceKey of the current data-source in the URL template.
- Syntax:
{{sourceKey}}
Examples:
https://example.com/details?source={{sourceKey}}
https://example.com/{{sourceKey}}/{{node:"Company"}}
Base URL
- Usage: insert the base URL of the Linkurious Enterprise server in the URL template.
- Syntax:
{{baseURL}}
- Note: the inserted base URL value always ends with a
/
.
Examples:
{{baseURL}}workspace/new?key={{sourceKey}}&populate=edgeId&item_id={{edge}}
{{baseURL}}workspace/new?key={{sourceKey}}&populate=nodeId&item_id={{node}}
{{baseURL}}plugins/my-plugin/show?key={{sourceKey}}&node={{node}}
Set of node IDs
- Usage: insert the IDs of all currently selected nodes in the URL template.
- Syntax:
{{nodeset}}
- Note: the node IDs are inserted as a comma-separated string, e.g.
55,4,128,12
By default, a custom action with a {{nodeset}}
variable will be available on all nodes.
To make this custom action available only for Account
nodes, use the following syntax: {{nodeset:"Account"}}
.
Example:
http://example.com/nodes?ids={{nodeset}}
{{baseURL}}plugins/my-plugin/show?nodes={{nodeset:"Company"}}
Set of edge IDs
- Usage: insert the IDs of all currently selected edges in the URL template.
- Syntax:
{{edgeset}}
- Note: the edge IDs are inserted as a comma-separated string, e.g.
55,4,128,12
By default, a custom action with a {{edgeset}}
variable will be available on all edges.
To make this custom action available only for HAS_ACCOUNT
edge, use the following syntax: {{edgeset:"HAS_ACCOUNT"}}
.
Example:
http://example.com/edges?ids={{edgeset}}
{{baseURL}}plugins/my-plugin/show?edges={{edgeset:"HAS_ACCOUNT"}}
Set of node properties
- Usage: insert the property-values of all currently selected nodes in the URL template.
- Syntax:
{{nodeset.property_name}}
- Notes:
- the node properties are inserted as a comma-separated string, e.g.
france,germany,uk
- empty properties are ignored
- several
{{nodeset}}
variables can be used in a template with different property and category constraints
- the node properties are inserted as a comma-separated string, e.g.
By default, a custom action with a {{nodeset.property_name}}
variable will be available on all nodes.
To make this custom action available only for Account
nodes, use the following syntax: {{(nodeset:Account).propety_name}}
.
Example:
http://example.com/nodes?countries={{nodeset.country}}
{{baseURL}}plugins/my-plugin/show?ssn_list={{(nodeset:"PERSON").ssn}}
http://google.com/search?q={{(nodeset:PERSON).name}}+{{(nodeset:PHONE).number}}
Set of edge properties
- Usage: insert the property-values of all currently selected edges in the URL template.
- Syntax:
{{edgeset.property_name}}
- Notes:
- the edge properties are inserted as a comma-separated string, e.g.
55,4,128,12
- empty properties are ignored
- several
{{edgeset}}
variables can be used in a template with different property and type constraints
- the edge properties are inserted as a comma-separated string, e.g.
By default, a custom action with an {{edgeset.property_name}}
variable will be available on all edges.
To make this custom action available only for TRANSACTION
edges, use the following syntax: {{(edgeset:TRANSACTION).propety_name}}
.
Example:
http://example.com/edges?amounts={{edgeset.amount}}
{{baseURL}}plugins/my-plugin/show_transactions?numbers={{(edgeset:"TRANSACTION").number}}
http://google.com/search?q={{(edgeset:HAS_ACCOUNT).reference}}+{{(edgeset:TRANSACTION).device}}