Link

Extension API

Table of contents

  1. Description
  2. Features
    1. getCreator
    2. getLastModifiedBy
    3. getName
  3. Considerations and Guidelines

Since: 0.1.0
Context: Any
Category: Generic

Description

The Extension API provides information regarding the XtendM3 extension that is currently in use. This can be used to retrieve metadata about the current extension and show to the user or use for logging purposes.

Features

getCreator

To retrieve the username of the extension creator.

Example:

public class SampleExtension extends ExtendM3Trigger {
    private final ExtensionAPI extension
    private final InteractiveAPI interactive
    
    public SampleExtension(ExtensionAPI extension, InteractiveAPI interactive){
        this.extension = extension
        this.interactive = interactive
    }
    
    public void main(){
        String extCreator = extension.getCreator()
        interactive.showOkDialog("${extCreator} created this extension.")   
    }
}

getLastModifiedBy

To retrieve the username who last modified the extension.

Example:

public class SampleExtension extends ExtendM3Trigger {
    private final ExtensionAPI extension
    private final InteractiveAPI interactive
    
    public SampleExtension(ExtensionAPI extension, InteractiveAPI interactive){
        this.extension = extension
        this.interactive = interactive
    }
    
    public void main(){
        String extLastModifiedBy = extension.getLastModifiedBy()
        interactive.showOkDialog("${extLastModifiedBy} last modified this extension.")
    }
}

getName

To retrieve the name of the extension currently being used.

Example:

public class SampleExtension extends ExtendM3Trigger {
    private final ExtensionAPI extension
    private final InteractiveAPI interactive
    
    public SampleExtension(ExtensionAPI extension, InteractiveAPI interactive){
        this.extension = extension
        this.interactive = interactive
    }
    
    public void main(){
        String extName = extension.getName()
        interactive.showOkDialog("Current Extension name: ${extName}")
    }
}

Considerations and Guidelines

When an extension is created, the getCreator() method will return the original creator of the extension. However, when the extension is imported to a different tenant/environment, the user who uploaded the extension will now become the new creator.