Skip to main content

Extensions

Suggest edit Updated on November 10, 2021

Use extensions if a full target implementation is not required or if you need functionality that is not exposed by the target, such as when the native control is a grid with a useful Export method, but the Export method is not part of the IGridTarget interface.

Extensions are similar to UI Connectors but perform a different function. Any public property, method, or event on an extension is added directly to the adapter control. Unlike UI Connectors, the control’s type does not change but you can add members to the control to extend its functionality.

In Pega Robot Studio there are the following extensions:

  • Type extensions
  • Control extensions

Adding type extensions

You can add type extensions to any control. For adapter controls, the type extension is applied to all other adapter controls that are associated with the same native control type.

For example, a project can contain three grid adapter controls, two associated with DevExpressPivotGrids, and one associated with a standard .NET DataGrid. A type extension created against the first DevExpressPivorGrid would apply to the other DevExpressPivotGrid, but not to the .NET DataGrid, even though they are all adapter grid controls.

If, however, you create a type extension on a non-adapter control, like a script or automation, the system applies the extension to all controls of the same type and there is no native control type to consider.

To add a C# type extension class to the project, perform the following steps:

  1. In the Application Designer, right-click the control.
  2. On the context menu, click the Create Type Extension option.
    This class is decorated with the ExtendTypeAttribute attribute. This attribute indicates the type supported by the extension, as in the following example:
    Type extension example
    C# code showing an example of a type extension.

Adding component extensions

Component extensions are specific to a single control. The generated extension class has the ExtendComponentAttribute attribute instead of the ExtendTypeAttribute attribute. This attribute contains the component ID of the control you want to extend. Do not modify this attribute.

To add a C# component extension class to the project, perform the following steps:

  1. In the Application Designer, right-click the control.
  2. On the context menu, click the Create Component Extension option.
    This class is decorated with the ExtendComponentAttribute attribute. This attribute indicates the type supported by the extension, as in the following example:
    Component extension example
    C# code showing an example of a component extension

Building extensions

All extensions have a Control property. Use this property to access the extended control.

Additionally, extensions associated with adapter controls have a NativeControl property. Use this property to operate against the associated native control.

Review the following example of an extension that exposes an Export method. The system automatically adds this method to the control and makes it available for use in an automation.

Export extension
C# code example showing an export extension.

Did you find this content helpful? YesNo

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us