Designer Behaviors
  • 07 Aug 2024
  • 2 Minutes to read
  • Dark
    Light

Designer Behaviors

  • Dark
    Light

Article summary

Overview

The IDesignerBehavior interface is the base behavior interface for Flow, Rule, MatrixRule, Form, Report, and TextMerge Designer entities. This interface includes common functionality of all designer behaviors, which may be needed to abstract from specific behaviors. This helps users configure the gallery dialog displayed when using the CREATE FLOW/RULE/FORM actions. This allows users to adjust the behavior's appearance in the dialog by modifying the behavior's properties. Below is a code example of the IDesignerBehavior interface.

public interface IDesignerBehavior
{
    string Name { get; }
    bool IsUserSettable { get; }
    string CreateGalleryImage { get; }
    string Category { get; }
    string GetDescription();
    string BaseEntityName { get; }
    int DisplayOrder { get; }
}

public interface IDesignerBehavior<T> : IDesignerBehavior
    where T: class
{
    DataDescription[] ProcessInputDeclaration(T entity, DataDescription[] inputData);         

    void OnBehaviorAssigned(T entity);
}

IDesignerBehavior Properties

Property NameDescription
NameUser-friendly behavior name. This property is defined in default behaviors and is generated from the behavior class name.
IsUserSettableSets whether or not a Flow behavior shows up in the Decisions Portal UI when a user sets the behavior of a Flow. When set to false, this behavior will not appear in the behavior list for users to select from but can still be used by the user's code to set Flow behavior on Flows.
CreateGalleryImageImageId of ImageInfo class. ImageId should match ImageInfoType.StoredImage
CategoryCategory (in gallery dialog) where behavior will show up
GetDescriptionSpecifies behavior description
BaseEntityNameEntity name which will be suggested when creating an entity based on a behavior
DisplayOrderSpecifies behavior order in the gallery dialog

Example

In most cases, simply overriding the Category property and GetDescription() method will be needed. The Name and BaseEntityName will be generated from the behavior class name. These can be overridden if a user wants to specify a different Name for behavior and BaseEntityName.

The IDesignerBehavior interface will be extended in the future. Methods will be removed from specific interfaces and moved to IDesignerBehavior. [Obsolete] will indicate that methods will be removed from future versions.


Below is a code example of creating a Healthcare category in the Flow Designer entity. 

public class InsuranceFlowBehavior : DefaultFlowBehavior
    {
        public override int DisplayOrder => 0;
        public override string Category => "Healthcare";
        public override string GetDescription()
        {
            return "Flow type allows to identify client insurance needs.";
        }
    }
 
    public class AccidentFlowBehavior : DefaultFlowBehavior
    {
        public override int DisplayOrder => 10;
        public override string BaseEntityName => "Accident Action";
        public override string Category => "Healthcare";
        public override string GetDescription()
        {
            return "Flow type allows to identify insurance payout in case of an accident.";
        }
    }



Was this article helpful?