You need to change property type (integer to real) or name, so you need to copy property value.
Object, the Project in this case, was created with default property Name Or Title (ID = 0) as a primary property (Name property). After a while, we realized, we need to change the project name to a more generic, more convenient name - it would help us a lot. So we decided to add a new Property called “Project Name”, and made it automatic. When we changed that property “Project Name” to “set as Name” we got this error:
You must remove the “Name or title” property from the list because you have specified another property as the name property of this class.
By design, “under the hood”, M-Files engine is copying every property that is “Set as Name” to “Name” or title” property (with ID = 0). Our new idea for Project name was: [Company] + Name.
One way of copying property is to add Automatic Values. Select property that you want to copy and Update that property. You can do that if your copied property is text and you are not using that property in any another classes. Our problem was that we already used Name in “Activity” object and we wanted to use the same one to have everything consistent.
The other options were:
- Manually copy
- For us, every manual work, even the smallest one, is some kind of defeat - because of the business we are in.
- Create a script that uses M-Files API and run One time
- Possible solution, but it takes a little more time - and we appreciate time.
- Use LogicApps / Flow
In short, Logic Apps or Flow represent an easy way of automation, it integrates your endpoints of business, like DMS, SharePoint, E-mail, CRM, Database, etc. without programming. If you have Office 365 account you can use Flow, but for Logic Apps you will need an Azure account. There are tons of connectors for different systems and for this case we only need a connector for M-Files (that we developed).
In a nutshell, we need:
- Connection to Vault
- Search for Object - Projects
- For each object copy “Name or title” property to “Name” property
For this solution we will use these three variables. If we decide to change their values later on, we will have no problem with that and it will be easier to understand.
- Variable name: Property: Name Or Title
- Value: Name or title
- Variable name: Property: Name
- Value: Name
- Variable name: Project
- Value: 22
We are searching all objects with Class = Project (ID = 22).
Iterate trough every object
We are iterating trough every object/project and we will copy “Name or title” to “Name”. We need to ask every property from “Project”: are you “Name or title”? If yes, then copy that to property “Name”.
Then we can easily set property “Name” as Name on the class:
At the final stage, we update Property Name:
By using Logic Apps we solved a potential business problem easy and without programming. I would also say very quickly, but it took some time to write this and take screenshots so maybe programming would be faster :).
Extras: Next week I’ll show you how you can sync Contacts from M-Files to your Outlook…
If you have any questions, contact me on my email [email protected]