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

How to remove a property on a new document created from a template.

Hi there! 

We need to remove a set of properties from a new document created from a template.

Ideally, the properties are removed before displaying the metadata card and not just set to empty and then hidden using the metadata card customizations.

Is there any way to go about doing this? Either through some clever configuration or perhaps some code?

Best regards

//Fred_

  • Or even better, is there a way to configure M-Files never automatically to bring over specific properties when creating from a template?

  • Is it property values or the empty property you want to get rid of?

    It is not necessary to set values even on required properties when an object is marked as a template, so you can just leave the values empty on the template.

    If you want to get rid of the properties themselves, you should remove them from the class. You can configure Metadata Card Configuration to add extra properties based on predefined filters - e.g. "Document type" equals A, add property B.

  • The issue is that property A needs to have a value on the published template. For example, when the template expires.

    Then when creating a new document from this template, by default, the property value will follow the new object. This we do not want. The only way I have found to get rid of it is to remove its value with metadata card customization, setting it to empty. But in this case, the property is still empty and additional as it is still a part of its collection even though it is not a part of the class.

    We need a way to remove the property value from the collection altogether for the new document.

  • And you cannot add a sub rule that removes the additional property, when "Is template" is not True?

    If you can configure the value to be empty it should also be possible to set Is Additional to No.

  • By removing the property, I assume you mean force setting it to empty, which is the only option from what I can gather.

    This, however, only sets the property to an empty value, which in the metadata terms, is still some sort of value.

    Take an example property of an "Approver" that approved a particular template. This they do not wish to have on the documents that use this template. When setting the value to empty, and even with additional set to no, it still shows up:

    This issue is that it still has an "empty" value and is still a part of the property collection for that object.

  • If the property was added as additional by configuring MCC to "Is addtional" = Yes, then it should also be possible to set it to "Is addtional" = No. If the value is empty it should dissappear. Otherwise you may have to just hide it.

  • That is not an ideal solution because when you hide it, it is gone, and a user cannot use it again unless some other rule unhides it, and then you are in a rule limbo.

    Perhaps I am not entirely clear. We have a document in class A that is a template for documents of class B via the additional classes property that allows doing this. The template class has a property, for instance, Approvers, that displays the approvers that approved the template. When creating a new document in class B from this template, the Approvers property is also transferred, which is not desired behaviour as it is not required in the new document class.

    The Approvers property was not initially added using "Is additional" in the template class and had a value there. Setting it to empty and then is additional = no does not remove a property with an empty value; that only works if the property never had a value to begin with.

  • Would it be possible to move the template from Class A to Class B once it has been approved? In that process you might be able to remove the Approval property and only have the standard properties required in Class B.

    Not sure if the logic that keeps a property once used will allow this, but might be worth a try. If it doesn't then I can't see how you could remove it all.

    Another option is to group properties and place Approver in a group at the bottom and set it to be collapsed by default in Class B. This way it will be out of sight but still available.

  • For anyone finding this older thread, this is now possible with M-Files September '23 Update and later: the configuration options are under Advanced Vault Settings > Client > Common > Templates > Template-Only Properties.