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

MFIdentifier : Vault element with the alias "CL.Coexya.RH.MTAM.DemandeMtam" is not found.

Hello,

I am getting errors after adding new MFidentifiers to my code. I am probably not understanding when it's instanciated. The code is simple: 

I am getting the error when the first MFidentifiers is used. ((int)mfIdClassDemandeMtam) . If I put the ID , then of course it works but it stop to next mfidentifier ((int)mfIdPropResolution).

mfIdPropMatricule and mfIdPropEmail are working fine in another function. There are the first added to my app.

A collleague and me crosscheck that thoses aliases are in the correct vault. We copied the aliases form the vault to visual studio.

Any hint?

Thanks, 

Amaury

Parents
  • Move the declarations to your configuration class.  MFIdentifiers are only automatically resolved on the configuration class.

  • Thank, so anytime I need to use it in my vaultApplicationClass, I need to do :

    (int32)this.Configuration.mymfidentifier ?

    Thank you

  • Yes, or grab its ID:

    var id = this.Configuration.MyIdentifier.ID;

    The MFIdentifier class has lots of other useful properties, such as IsResolved, that may be used for gatekeeping certain parts of logic, or for throwing exceptions if misconfigured.

    I'd also highlight that you should add [DataMember] and [MFPropertyDef] attributes to the configuration elements so that they get exposed in the M-Files Admin.  That'll allow you to easily reconfigure them if needed.

    It may be worth reaching out to the Channel team who run periodic training on the VAF.  Some of this is covered directly, and they'd be more than happy to help talk you through best practices during the training.

  • Thank you.

    Wasn't clear for me that MFidentifier HAVE TO BE declared in the configuration

Reply Children
  • You can declare them outside, but they will not be automatically resolved.  It's best to place them in the configuration.

  • Sorry Craig but I have another question on the same topic Slight smile

    What could cause the no resolution of the MFIdentifier in the configuration class? it looks like that:

    thank you?

  • In your code, if you reference "this.Configuration.mfidPDIDGed.ID", what does this resolve to?  -1?  Is there a property in your vault with that alias?

  • Hah, I realised that something I am using actually solves this problem.

    The issue is that your code adds that the property definition is required, but in the JSON configuration it's empty.

    If you are assigning a default value and you want your code to test whether it's valid then you can state that in your code: