Customizing
Version 27 Version 26 39.5.25 39.5.23 39.5.22 39.5.21 39.5.20 39.5.19 39.5.18 39.5.17 German English
Version 27 Version 26 39.5.25 39.5.23 39.5.22 39.5.21 39.5.20 39.5.19 39.5.18 39.5.17 German English

Customize Deeplinks

General

Deep links in PLANTA project allow you to execute user-defined actions directly via URL. For example, users can access a linked module directly from an email—without having to manually navigate the system.

Technical Implementation

Requirement

  • Creation of a user-defined class that inherits from BaseProtocolAction.

Procedure

  • Define a class by

    • generating a subclass of ppms.protocol.BaseProtocolAction,

  • implement the execute() method,

  • access URL parameters,

    • self.path_parameters for path segments and

    • self.query_parameters for query strings.

Example

Python
from ppms.protocol import BaseProtocolAction, get_any_module_object

class OpenCustomerModuleAction(BaseProtocolAction):
    def execute(self):
        module = get_any_module_object()
        module.open_module('100000')

Note

  • Save the class, e. g. in customer/protocol.py.

Procedure

  • Create a new entry in the Deeplink module:

    • Set action to a user-defined URL (e.g. /special_module),

    • Set the Python function to the path to your Python class (e.g. customer.protocol.OpenCustomerModuleAction),

    • Set a checkmark in the Activated checkbox,

    • Define a Python ID to be able to reference this deeplink at a later point.

  • After setup, calling up <planta-web-client>/special_module opens module 100000.

Path and Query Parameters

Information

  • PLANTA deeplinks support both path parameters and query parameters. Both can be used for filtering or navigating nested hierarchies.

Path Parameter

Details

  • Used to clearly display hierarchical resources.

  • Path parameters can be defined directly in the deep link URL using angle brackets < >:

    • e.g.: project/<pr_id>.

      • Using the RESTful URL design.

Query Parameter

Details

  • Used for optional filters or additional modificators.

  • Automatic availability without having to explicitly define a query parameter:

    • e.g.: project/4711?foo=bar

  • The flexibility may also lead to longer URLs.

Query parameter values are always lists, since a parameter can occur multiple times.

Error Handling

Note

  • If a user attempts to access a non-existent deep link, an error message is displayed (text constant 002502). Deeplink actions must treat invalid user input respectively in their implementation.

Information

  • The 009DWK macro dynamically creates deeplinks based on record values.

  • The configuration is done via the DF configuration parameter (df_script_settings) with the DeeplinkGenerator key.

  • Either python_id (reference to a deep link record) or url (direct URL template) must be specified, but not both.

  • Path placeholders are defined in path_params, and query string values in query_params.

  • Each parameter contains either field (dynamic value from the current record) or value (static value).

Configuration examples

Minimal Example (URL Template)

JSON
{
  "DeeplinkGenerator": {
    "url": "/project/<pr_functional>/",
    "path_params": {
      "pr_functional": {
        "field": "fachliche_id"
      }
    }
  }
}

Dynamic and static path parameter

JSON
{
  "DeeplinkGenerator": {
    "url": "/project/<pr_functional>/view/<module>",
    "path_params": {
      "pr_functional": {
        "field": "fachliche_id"
      },
      "module": {
        "value": "terminplan"
      }
    }
  }
}

Query Parameter

JSON
{
  "DeeplinkGenerator": {
    "url": "/booking/<booking_id>/modify",
    "path_params": {
      "booking_id": {
        "field": "uuid"
      }
    },
    "query_params": {
      "hours": {
        "field": "load_act"
      },
      "comment": {
        "value": "Das war ein gutes Meeting"
      }
    }
  }
}

Reference via python_id

JSON
{
  "DeeplinkGenerator": {
    "python_id": "planning_dashboard",
    "path_params": {
      "pr_id": {
        "value": "000008"
      }
    }
  }
}

When using python_id the URL is identified from the referenced deeplink record. If the route changes, only the record needs to be updated; all DF configurations that point this out remain unchanged.

Combination with ButtonConfiguration

JSON
{
  "ButtonConfiguration": {
    "type": "Primary",
    "size": "Default",
    "content": "IconLabel",
    "danger": false
  },
  "DeeplinkGenerator": {
    "python_id": "planning_dashboard",
    "path_params": {
      "pr_id": {
        "field": "fachliche_id"
      }
    },
    "query_params": {
      "comment": {
        "value": "Das war ein gutes Meeting"
      }
    }
  }
}

Notes

Notes

  • Path parameters (< >) have to be defined correctly in the URL template and must be existing in the record, if they are read dynamically.

  • Query parameters are suitable for optional or flexible values.

  • The JSON format coexists with other DF configuration sections like ButtonConfiguration.

  • When using python_id, adjusting the deep link record is sufficient if the route changes.

Information

  • Deep links can be generated and displayed programmatically using the auxiliary functions in ppms.protocol.deeplink.

Module import

Python
from ppms.protocol.deeplink import (
    build_deeplink_url,
    copy_deeplink_url,
    build_and_copy_deeplink_url,
)

Available functions

Function

Description

Parameter

Return / Note

build_deeplink_url

Generates a complete deep link URL based on a python_id.

python_id: Python ID of the deep link record
path_params: Values for path placeholders (optional)
query_params: Query string values (optional)
webclient_url: Base URL (optional)

Returns the complete URL as str. Raises ValueError if python_id is not found.

copy_deeplink_url

Displays a completed URL to the user. In the Web Client: Copy to clipboard + status bar. Otherwise: Message box.

url: the deeplink URL to be displayed

No return value (side effect).

build_and_copy_deeplink_url

Combination: generates the URL and displays it to the user in a single call.

The same parameters as build_deeplink_url.

No return value (side effect).

Example

Python
url = build_deeplink_url(
    python_id="planning_dashboard",
    path_params={"pr_id": "000008"},
    query_params={"tab": "details"},
)
copy_deeplink_url(url)

Implementation details

DF configuration of the 009DWK macro

Processing order when parsing the configuration

  1. The configuration is parsed as JSON.

  2. If the JSON object contains the key DeeplinkGenerator, it is used as the deeplink configuration.

  3. If the JSON is valid but does not contain a DeeplinkGenerator key, parsing fails.

  4. If the text is not valid JSON, the system falls back to the legacy line format.

Legacy line format

The older line-based format is retained for backward compatibility:

  • First line: URL template with path placeholders or the python_id of a deeplink record.

  • Subsequent non-empty lines: Parameter assignments according to the following syntax:

Syntax

Meaning

parameter:feld_python_id

Read path parameter dynamically from the current record

parameter=statischer_wert

Use static path parameter

?parameter:feld_python_id

Read query parameter dynamically from the current record

?parameter=statischer_wert

Use static query parameters

Example: Path parameter from data field

/project/<pr_functional>/
pr_functional:fachliche_id

Example: Dynamic and static query data

/booking/<booking_id>/modify
booking_id:uuid
?hours:load_act
?comment=Das war ein gutes Meeting

Example: Reference via python_id

planning_dashboard

pr_id=000008