The M-Files Community will be updated on Tuesday, April 2, 2024 at 10:00 AM EST / 2:00 PM GMT and the update is expected to last for several hours. The site will be unavailable during this time.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Configuration attribute Object

Has anyone an example for a configuration parameter where I can select an object of a previously selected object type such as:

[DataMamber]

[ObjType]

[JsonConfEditor(Required = true)]

public MFIdentifier MyObjType { get; set; }

[DataMember]

[Object(RefMember = "MyObjType"]

[JsonConfEditor(Label = "Please select an object")

public MFIdentifier MyObject { get; set; }

or should I use int or ObjVerEx here?

  • Hi, thanks for your patience on a response, I've reached out to some of our development resources more familiar with the API and am currently waiting for a response.  I will post another response hopefully soon.

  • Hey there, so I have good new and bad.  The bad is this Object Attributes aren't available directly through the Configuration UI, however, this content can be addressed using ValueListItem, since Objects and Value lists are very much related this content is accessible using the following:

    [DataContract]
    public class Configuration
    {
        [DataMember]
        public List<ObjectSelector> ObjectSelectors { get; set; } = new List<ObjectSelector>();
    }
    
    [DataContract]
    [MFValueList(AllowObjTypes = true, RefMember = nameof(ObjectSelector.ObjectType))]
    public class ObjectSelector
    {
        [DataMember]
        [MFValueList(AllowObjTypes = true)]
        public MFIdentifier ObjectType { get; set; }
        
        [DataMember]
        [MFValueListItem]
        public MFIdentifier Object { get; set; }
    }

    A couple things to mention so you're aware, this also lists value lists as well as object types, but it does certainly allow you to select an object type and then select an item from the linked selector.  Additionally, it may be that you don't need "AllowObjTypes = true" on both of those MFValueList attributes (this wasn't tested).

    Here's an example for reference where something similar is being done for Workflow and Workflow States.  Thanks  for your input on this!