Text Merge Behavior

Last Updated: 03/28/2018 Introduced in Version: 2.0

Similar to Flow Behavior and Folder Behavior, Text Merges can be given a behavior with predefined inputs, limit whether or not inputs are visible to the user, and/or add additional actions in the Text Merge action menu.

To create a Text Merge behavior, create a public class that inherits from  DefaultTextMergeBehavior. This will give you three overrideable methods which you can use to control the behavior of your Text Merge. These methods are:
  • public override void OnCreate(AbstractTextMerge merge) — use this method to set default input data for your text merge. Default behavior for this method is empty (No modifications are made on creation). Below is an example snippet showing how to add an input called Color to your text merge.

    When a text merge with this override is created, it will have a piece of input data which shows up in the designer. (Note: use your new behavior setting, in this case “Text Behavior,” when opening then Text Merge):

 
2017-02-10_115033 
  • public override bool ShowInputs() — use this method to hide the inputs from a designer user. Default behavior for this method is true (inputs are shown to user). Below is an example snippet showing how to hide the input data from the designer user.
When a text merge with this override is created, it will show up in the designer with the input data hidden as shown below.
 2017-02-10_095608
 
 
If we had not overridden this method, the input data section would appear to the designer user as shown below.
 2017-02-10_095032
 
 
  • public override BaseActionType[] GetAdditionalActions(ElementRegistration elementRegistration, TextMerge textMerge) — use this method to add additional actions to the actions menu of your text merge. Below is a snippet showing how to add an action that will copy the Text Merge’s name to the user’s clipboard.

     

When a text merge with this override is created, it will show up in the designer with the additional action displayed as shown below.
 
2013-10-18_1418
 
After coding a Text Merge Behavior, you will need to create an action that allows users to create a Text Merge with your new behavior. To do this, we will create a folder behavior which adds an action to the folder to create a Text Merge with your new behavior. Below is a snippet from a folder behavior class which shows how to add an action for creating a Text Merge with your new behavior type.
A folder with this behavior will display an action called Create Sample TextMerge as shown below.
 
2013-10-18_1448

Additional Resources