Loading

Let's talk how we can help you succeed.

Submit this form and we will reach you soon.

Thank you for getting in touch

Thank you for submission. We have received your message and will contact you soon. If your inquiry is urgent, please use the telephone number listed below, to talk to one of our staff members.

Talk to you soon,
Unitfly Team +385976834345

Unitfly: Blog

How to copy properties in M-Files


Author: Alan Debijađi
Date:
Primary tag: flow
Like it? Share it...


Problem

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.

NameOrTileErrorFull

Solution

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

Logic Apps

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).

Solution

In a nutshell, we need:

  • Connection to Vault
  • Search for Object - Projects
  • For each object copy “Name or title” property to “Name” property
    LA_Prvi

Variables

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

Search object

LA2
We are searching all objects with Class = Project (ID = 22).

Iterate trough every object

LA3

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”.

LA4
LA5

Result

Namecopied

Then we can easily set property “Name” as Name on the class:
SetName-as-Name

At the final stage, we update Property Name:
UpdateName

Summary

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]

Alan Debijađi

Co-Founder of Unitfly, IT Freddie without voice, but with the certain skills in #Leadership, #BusinessDevelopment, #Inovation, #Gamification and #Love :)

Read more posts by this author

© 2020 Unitfly, All rights reserved