Set Property based on the incumbent in a specific position

In a specific document class, I want a property in the document to be automatically filled with an employee who is in a specific position (Human Rights Officer). If that position is empty, then the property should be blank.

How can I achieve this through Property Calculator?

Parents
  • Could you describe the desired behavior in more detail? Is there some reference to an Employee object already on the document metadata or did you mean that M-Files should search for an employee in such a position? When should this search happen (e.g., when the document is created or when it enters a specific workflow state)?

  • Good morning Joonas,
    There is no reference to an employee object already in the document metadata - yes I was meaning that M-Files should search for an employee in such a position.

    So in a specific state, the document has to go to the Employee who is in the position "Human Rights Officer". If the position is empty, then the document will automatically proceed to the next state, so I was thinking of having an automatic state transition that references the property, and if it is empty, it moves.

    The only thing I am unsure about is how to translate this (searching for the Employee in the specified position) into Property Calculations for the document class; or maybe there is another method.

  • Sounds to me like a simple automatic transition with a trigger based on "Human Rights Officer" - "Is empty or missing". No need for Property Calculator if you just want to check whether a given property is empty or not.

  • The problem with it, that document does not have such property as we don't know if we have HRO in employee object or not.

    As Joonas said, there should be some search done if there are any employee with HRO title or not for automatic state transition. If there is none, automatic state transition should happen..

    I'd go for a vbscript that ends with allowstatetransition = true but MS killing VB and stuff...

  • I think the Search Objects rule in Property Calculator should be able to do this using the workflow state as a filter. Have you tried this already?

    What concerns me is that the property is empty when the object enters the state and if you configure an automatic transition with an "is empty" rule M-Files might move the object forward before Property Calculator has had time to do the search and potentially fill the property.

    I don't recall off the top of my head how M-Files behaves in such a situation so this would need some testing. If there are issues you may need some additional Boolean property to use as an indicator that the search has been performed. 

  • On the top of my head, the search stuff and automatic transition would work, BUT i think that the assignment to be made to the HR officer would be calculated before the actual search (calculation) has been made. 

    You would need either to make the search for HR earlier in the process (and assume that the value has remained the same), or need to split this into two workflow states (Search for HR / Set assignment to HR), with possible by pass if result of Search for HR had led to an empty property. 

Reply
  • On the top of my head, the search stuff and automatic transition would work, BUT i think that the assignment to be made to the HR officer would be calculated before the actual search (calculation) has been made. 

    You would need either to make the search for HR earlier in the process (and assume that the value has remained the same), or need to split this into two workflow states (Search for HR / Set assignment to HR), with possible by pass if result of Search for HR had led to an empty property. 

Children
No Data