Custom actions, triggers, and UI fields

Create custom actions & triggers 

You can register your own triggers and actions. They should be registered in custom Sitefinity modules as shown in the sample below. For more information, see Custom modules

To register a trigger, you need to implement IServiceHookTriggerProvider interface. You also need to create a new trigger class that inherits from ServiceHookTriggerSettingsBase

When defining trigger settings, you need to add this data in constructor: 

  • key - unique key for trigger 
  • triggerTitle - title that be displayed in UI. 
  • eventType - event that you want to track 
  • module - name of the module 

Also, you can add additional event filter in IsMatch function.  

Registering actions

To register custom actions, you must implement IServiceHookActionProvider interface. In addition, you need to create new action setting class inherited from IServiceHookActionSettings

When defining action setting you need to: 

  • Define unique Key
  • Define action Title that is displayed in UI. 
  • Define ParametersType property 

You can also define properties, which can be used in the UI when executing actions. For more information, see Widget designers

When you want to encrypt field to hide sensitive data, you can use Sitefinity.Configuration.SecretData attribute 

Finally, you must implement ExecuteActionAsync method as shown in the sample below. 

Custom service hook sample 

This sample code creates a contact in HubSpot when a user logs in to Sitefinity.  

Customize UI fields 

You can customize Servicehook UI with custom JavaScript implementation. 

You can customize Admin App fields by overriding them. Learn more about custom fields in GitHub

EXAMPLE: Using the extensions, you can replace Title field by providing this data to FieldData object: 

fieldName: "Title",

fieldType: FieldTypes.shortText,

typeName: "widget-servicehooks"

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?