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

Saving metadata without checking-out document

Hi. 

I would like to ask a question. When I change document metadata with a workflow state, they are not displayed in the document until it´s checked-out. Is there any way how to automate this thing with the script? I am not sure if I read well that this can be done only with VAF? 

Thank you very much for your help. 

Parents
  • Hi Lola,

    Not quite sure if I understand correctly but here some thoughts.

    Generally, in workflow pre/post conditions and state actions, you should be able to set property values without checking out objects as in that moment of time you have ObjVer and opened transaction. You can use VAF (C# .NET) or you can script it in VB script (would generally recommend VAF, better for maintenance).

    If you have simple value setups (e.g. static values, or some simple calculations), you can easily set it up in workflow pre/post conditions without coding (e.g. setting fixed state property, current date time etc.)

    Displaying of metadata is not really connected with setting values and you can controll it through metadata card rules.

    These are ways to setup workflow actions in VAF: https://developer.m-files.com/Frameworks/Vault-Application-Framework/Attributes/Workflows/.

    Dejan

  • Hi Dejan. 

    Thank you very much for your answer. I know about coding and using VAF. I just wanted to know if it´s possible to code my issue in VB script as I am not familiar with C#. The problem is that I have a Word document, I fill in some metadata in M-Files like by whom it was approved and on what date but then I would like to display these data straight in the Word file without pushing user to check-out document. When you open it as read-only, you can see that the data are not in there. And this should be done with the code in Workflow when it reaches relevant state. Don´t know if I am clear enough.  

  • I thought that it could be something like this. To open the document for editing where file is automatically checked-out, but it´s not doing anything.

    If ObjVer.Type = MFBuiltInObjectTypeDocument Then 


    Dim PropertyValues: Set PropertyValues = Vault.ObjectPropertyOperations.GetProperties(ObjVer)

    Dim oFiles: Set oFiles = Vault.ObjectFileOperations.GetFiles(ObjVer)

    If oFiles.Count > 0 Then
    Dim oFile: Set oFile = oFiles.Item(1)

    oVault.ObjectFileOperations.OpenFileInDefaultApplication Application.Hwnd, ObjVer, oFile.Version, MFFileOpenMethodEdit

    End If 

    End If

Reply
  • I thought that it could be something like this. To open the document for editing where file is automatically checked-out, but it´s not doing anything.

    If ObjVer.Type = MFBuiltInObjectTypeDocument Then 


    Dim PropertyValues: Set PropertyValues = Vault.ObjectPropertyOperations.GetProperties(ObjVer)

    Dim oFiles: Set oFiles = Vault.ObjectFileOperations.GetFiles(ObjVer)

    If oFiles.Count > 0 Then
    Dim oFile: Set oFile = oFiles.Item(1)

    oVault.ObjectFileOperations.OpenFileInDefaultApplication Application.Hwnd, ObjVer, oFile.Version, MFFileOpenMethodEdit

    End If 

    End If

Children
No Data