Filtering configuration options
Compatibility
The content of this page can only be used if the following condition(s) are all met:
- You must target the Vault Application Framework 2.0 or higher.
There are situations where configuration options should be filtered according to the values of other options.
Filtering workflow state by workflow
For the filtering to work, you must:
- Ensure that the configuration elements are in their own class (e.g.
WorkflowTrigger, in the sample below). - Add the
MFWorkflowattribute to the new class. This is the type of the parent that will drive the filtering. - Add the
RefMemberproperty to theMFWorkflowattribute, providing it with the name of theMFIdentifiermember that identifies the parent (e.g.WorkflowTrigger.Workflow, in the sample below). - Other configuration values within the class which support filtering will now be filtered by the value of the parent (e.g.
Statewill be filtered byWorkflow, in the sample below).
using System.Collections.Generic;
using System.Runtime.Serialization;
using MFiles.VAF;
using MFiles.VAF.AdminConfigurations;
using MFiles.VAF.Configuration;
namespace FilteredConfigurationSample
{
/// <summary>
/// The entry point for this Vault Application Framework application.
/// </summary>
/// <remarks>Examples and further information available on the developer portal: http://developer.m-files.com/. </remarks>
public class VaultApplication
: ConfigurableVaultApplicationBase<Configuration>
{
}
[DataContract]
public class Configuration
{
[DataMember]
public List<WorkflowTrigger> WorkflowTriggers { get; set; }
}
[DataContract]
[MFWorkflow(RefMember = nameof(WorkflowTrigger.Workflow))]
public class WorkflowTrigger
{
[MFWorkflow]
[JsonConfEditor(Label = "Object Workflow")]
[DataMember]
public MFIdentifier Workflow { get; set; }
[MFState]
[DataMember]
[JsonConfEditor(Label = "State")]
public MFIdentifier State { get; set; }
}
}

In the MFWorkflow attribute above, the C# nameof operator is used to avoid hard-coding a string value which may change. This could be altered, instead, to: [MFWorkflow(RefMember = "Workflow")].
Filtering workflow state transitions by workflow
For the filtering to work, you must:
- Ensure that the configuration elements are in their own class (e.g.
WorkflowTrigger, in the sample below). - Add the
MFWorkflowattribute to the new class. This is the type of the parent that will drive the filtering. - Add the
RefMemberproperty to theMFWorkflowattribute, providing it with the name of theMFIdentifiermember that identifies the parent (e.g.WorkflowTrigger.Workflow, in the sample below). - Other configuration values within the class which support filtering will now be filtered by the value of the parent (e.g.
Transitionswill be filtered byWorkflow, in the sample below).
using System.Collections.Generic;
using System.Runtime.Serialization;
using MFiles.VAF;
using MFiles.VAF.AdminConfigurations;
using MFiles.VAF.Configuration;
namespace FilteredConfigurationSample
{
/// <summary>
/// The entry point for this Vault Application Framework application.
/// </summary>
/// <remarks>Examples and further information available on the developer portal: http://developer.m-files.com/. </remarks>
public class VaultApplication
: ConfigurableVaultApplicationBase<Configuration>
{
}
[DataContract]
public class Configuration
{
[DataMember]
public List<WorkflowTrigger> WorkflowTriggers { get; set; }
}
[DataContract]
[MFWorkflow(RefMember = nameof(WorkflowTrigger.Workflow))]
public class WorkflowTrigger
{
[MFWorkflow]
[JsonConfEditor(Label = "Object Workflow")]
[DataMember]
public MFIdentifier Workflow { get; set; }
[MFStateTransition]
[DataMember]
[JsonConfEditor(Label = "Transitions")]
public List<MFIdentifier> Transitions { get; set; }
}
}

In the MFWorkflow attribute above, the C# nameof operator is used to avoid hard-coding a string value which may change. This could be altered, instead, to: [MFWorkflow(RefMember = "Workflow")].