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

Operation canceled when I define an attribute StateAction

Former Member
Former Member
Hi,

When I define the function following in the VaultApplication class, M-Files cancel the state action.
In debug, I don't reach the line of code.
Do you have a sample code to use the attributes please.

    [StateAction("XONYX_QM_ST_APPLICABLE")]
    public void WorkflowStateAction(StateEnvironment env) {
      xQMT.finalDocUpdateVersion(env.Vault, env.ObjVer);
    }

Thanks
  • There are attribute examples on the developer portal: developer.m-files.com/.../

    When you say "M-Files cancel the state action", do you mean you get some error message or that the action just doesn't run? Are there some errors in the Windows event log?

    To troubleshoot, you should first open your workflow state in M-Files Admin and see that there is some script in the state action (Action tab > Run script > Edit...). This script is added automatically when you install your vault application. If there is no script there, then the state action hasn't been registered properly. Check that the state alias is correct in your code and try uninstalling and reinstalling the vault application.
  • Former Member
    Former Member
    Thanks Joonas,

    When I replace the M-Files automatic code on the state script with my code, my code is execute but I have an other problem.
    I had an error System.IO.FileNotFoundException "Impossible to load the file or assembly 'Newtonsoft.Json, Version=10.0.3,...
    My librairies are develop with Json 10.0.3. I have upgraded the nugets Json in version 10.0.3 and when I call my code with VaultApplication, I have the error Json :

    System.IO.FileNotFoundException : 'Impossible de charger le fichier ou l'assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' ou une de ses d?pendances. Le fichier sp?cifi? est introuvable.'

    If I call my code with a Visual Project, my code is execute without error (with Json 10.0.3)
    Maybe the problem with the attributes is due to the Json version, can you confirm the VaultApplication V1.0.128 is compatible with Json 10.0.3

    When I go back to the code with attribute SataeAction (with Json 10.0.3), the state action hasn't been registered, the script is empty
    If I go back with Json 6.0.8, the the state action has been registered correctly


  • Former Member
    Former Member
    Hi Joonas,

    The problem is the Json Version, MFiles.VAF has a dependance Json 6.0.0

    Do you have a new version of MFiles.VAF compatible with Json 10.0.0 please, it's very important ?

    Thanks
  • The next VAF version (currently being beta tester by some partners) raises the json.net dependency to V10.

    This is expected to be released in the next month or so.

    If you are a partner and are happy to beta test the new version (accepting that it may have issues) then please contact me via your CAM for options.

    Regards,

    Craig.
  • Former Member
    Former Member
    Hi Craig,

    I am the partner ONYX in France but what is the CAM ?
    I can test the beta version VAF
    Where can we download the beta and release versions M-Files server, client, VAF, etc... ?

    Thanks
  • Please send me an email at craig.hawker@m-files.com.

    Please note that I am on holiday until the end of next week, though.

    Regards,

    Craig.