Guide to Applications

How to Execute Standard Data Workflows

When you work with data in C1 CMS, you use its standard data workflows. These data workflows allow you to add, edit or delete data items.

When you add or edit a data item, a data editing form opens specific to the data type in question. You can however customize the form in many cases by editing its form markup.

If you use data elements of a specific type in your console application, you can use these standard C1 CMS-specific data workflows to manage the data items.

Three actions are available for executing the standard data workflows:

  • AddDataAction
  • EditDataAction
  • DeleteDataAction

Please note that EditDataAction and DeleteDataAction can be only used with DataElements and DataFolderElements.

How to Add Data

When you want to add a child element to a tree element in C1 CMS (for example, a sub page to a page, or a data item to a data type), you use its standard Add Data workflow. Normally, you select the parent element and click Add on the toolbar or in the context menu.

Figure 18: Standard Add Data action

It opens a specific “Add Data” form.

When added, the new item appears as a child element under the parent element.

To attach the Add Data workflow to an element, you should use an AddDataAction element:

  1. Locate an element you want to attach the action to.
  2. Add an Actions element within the element if necessary.
  3. Add an AddDataAction element within the Actions element.
  4. Set the required attribute:
  • Type: The data type to add an item to

If necessary, set its optional attributes:

  • Label: A custom label of the action
  • Tooltip: A custom tooltip of the action
  • Icon: The icon of the action that appears on the toolbar and in the context menu
  • CustomFormMarkupPath: The path to an alternate Form UI XML file
<Element Label="Blog Entries" Id="Root">
  <Actions>
    <AddDataAction      Label="Add Blog Entry"      Type="Composite.Community.Blog.Entries"/>
  </Actions>
</Element>

Listing 25: Attaching an Add Data action

Please note that the type you specify in the Type attribute (Step 4) must match that of the child elements contained in the parent element.

How to Edit Data

When you want to edit a tree element in C1 CMS (for example, a page, a datatype, or a data item), you use its standard Edit Data workflow. Normally, you select the element and click Edit on the toolbar or in the context menu.

Figure 19: Standard Edit Data action

It opens an “Edit Data” form.

To attach the Edit Data workflow to a tree element, you should use an EditDataAction element:

  1. Locate an element you want to attach the action to.
  2. Add an Actions element within the element if necessary.
  3. Add an EditDataAction element within the Actions element.

If necessary, set its optional attributes:

  • Label: A custom label of the action
  • Tooltip: A custom tooltip of the action
  • Icon: The icon of the action that appears on the toolbar and in the context menu
  • CustomFormMarkupPath: The path to an alternate Form UI XML file
<DataElements Type="Composite.Community.Blog.Entries"   Label="${C1:Data:Composite.Community.Blog.Entries:Title}" Display="Auto">
  <Actions>
    <EditDataAction      Label="Edit Blog Entry" />
  </Actions>
</DataElements>

Listing 26: Attaching an Edit Data action

Please note that the EditDataAction is only available for DataElements and DataFolderElements.

How to Delete Data

When you want to delete a tree element in C1 CMS (for example, a page, or a data item), you use its standard Delete Data workflow. Normally, you select the element and click Delete on the toolbar or in the context menu.

Figure 20: Standard Delete Data action

To attach the Delete Data workflow to a tree element, you should use a DeleteDataAction element:

  1. Locate an element you want to attach the action to.
  2. Add an Actions element within the element if necessary.
  3. Add a DeleteDataAction element within the Actions element.

If necessary, set its optional attributes:

  • Label: A custom label of the action
  • Tooltip: A custom tooltip of the action
  • Icon: The icon of the action that appears on the toolbar and in the context menu
<DataElements Type="Composite.Community.Blog.Entries" Label="${C1:Data:Composite.Community.Blog.Entries:Title}" Display="Auto">
  <Actions>
    <DeleteDataAction      Label="Delete Blog Entry" />
  </Actions>
</DataElements>

Listing 27: Attaching a Delete Data action

Please note that the DeleteDataAction is only available for DataElements and DataFolderElements.

How to Use Custom Forms

When you use AddDataAction and EditDataAction, C1 CMS displays default editor forms.

Along with editing the Form Markup as described in Editing Form Markup (An Advanced Guide to Data Types) to customize the default forms, you can create your own forms and use them with these actions instead.

Please refer to the form schema definition files located at:

~\Composite\schemas\FormsControls

You will normally keep the form definition files on the website in a specific folder. To start using them, you should specify the relative path to them in the CustomFormMarkupPath attribute:

<EditDataAction  Label="Edit Task" 
  CustomFormMarkupPath="~\Frontend\Tasks\Forms\EditTask.xml" />

Listing 28: Using a custom form with an Edit Data action