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: 

public class VaultApplication
        : MFiles.VAF.Extensions.ConfigurableVaultApplicationBase<Configuration>
    {
        [MFPropertyDef(Required = true)]
        MFIdentifier mfIdPropMatricule = "PD.Matricule";
        [MFPropertyDef(Required = true)]
        MFIdentifier mfIdPropEmail = "M-Files.UserSynchronization.Email";
        [MFPropertyDef(Required = true)]
        MFIdentifier mfIdPropCommentaires = "PD.Commentaires";
        [MFPropertyDef(Required = true)]
        MFIdentifier mfIdPropCommentaire = "PD.Commentaire";
        [MFPropertyDef(Required = true)]
        MFIdentifier mfIdPropActeur = "PD.Coexya.RH.ActeurDuWorkflow";
        [MFPropertyDef(Required = true)]
        MFIdentifier mfIdPropEtapeAvant = "PD.EtapeAvant";
        [MFPropertyDef(Required = true)]
        MFIdentifier mfIdPropResolution = "PD.Coexya.RH.Resolution";
        [MFPropertyDef(Required = true)]
        MFIdentifier mfIdPropResolutions = "PD.Coexya.RH.Resolutions";

        [MFClass(Required = true)]
        MFIdentifier mfIdClassDemandeSAOexterne = "CL.Coexya.RH.SAO.DemandeSaoExterne";
        [MFClass(Required = true)]
        MFIdentifier mfIdClassDemandeSAOinterne = "CL.Coexya.RH.SAO.DemandeSaoInterne";
        [MFClass(Required = true)]
        MFIdentifier mfIdClassDemandeMtam = "CL.Coexya.RH.MTAM.DemandeMtam";
        
        [...]
        
        [EventHandler(MFEventHandlerType.MFEventHandlerBeforeCheckInChangesFinalize, Priority = 1, FilterOptions = MFEventFilterOptions.IgnoreTemplates)]
        public void BeforeCheckInChangesFinalize(EventHandlerEnvironment env)
        {
            [...]

            //class MTAM = 0
            if(currentObject.Class == (int)mfIdClassDemandeMtam || currentObject.Class == (int)mfIdClassDemandeSAOexterne || currentObject.Class == (int)mfIdClassDemandeSAOinterne)
            {
                commentairePropertyID = (int)mfIdPropResolution;
                commentairesPropertyID = (int)mfIdPropResolutions;
                acteurPropertyID = (int)mfIdPropActeur;
                etapeAvantPropertyID = (int)mfIdPropEtapeAvant;
            }

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.

Reply
  • 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.

Children