Hello. I'm a new to M-Files.
Could someone explain me how to make search condition on sub types.
I have Invoice object type and Line Item object is its sub type.
Updating Invoice object I need to find the Line Item objects associated with current Invoice. Help me please to create a proper search buider for such condition.
My event handler:
[EventHandler(MFEventHandlerType.MFEventHandlerBeforeCheckInChangesFinalize)] public void CalculateInvoicesTotal_Invoice(EventHandlerEnvironment env) { ObjVerEx obj = env.ObjVerEx; Vault vault = env.Vault; PropertyValues originalPropertyValues = obj.Properties.Clone(); if (!this.Configuration.Settings.IsEnabled || obj.Type != this.Configuration.Structure.Objects.Invoice) { return; } MFSearchBuilder builder = new MFSearchBuilder(env.Vault) .Class(this.Configuration.Structure.Classes.LineItem) .Deleted(false) .Property(this.Configuration.Structure.Properties.Owner, MFDataType.MFDatatypeLookup, obj.ID); List<ObjVerEx> results = builder.FindEx(); }
Thanks.