Customizing

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

Requirements

  • 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 <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.