Skip to content

ToLookups method with boolean property to control is latest version used or not #124

@esahaapamaki

Description

@esahaapamaki

When setting property values from ObjVerEx, there is already ToLookup method which is converting the ObjVerEx to Lookup. The default behavior isn't perhaps what we usually want, because then the lookup contains the version information. That's why it is great that there is already an overloaded method which has a boolean parameter what can be used to define that is the lookup pointing to the latest version or not.

ObjVerEx resultObject = searchBuilder.FindOneEx(); if (resultObject != null) { obj.SetProperty(Configuration.Structure.Properties.Document, MFDataType.MFDatatypeLookup, resultObject.ToLookup(false)); }

If you have List of ObjVerEx, what you want to set to the property, VAF contains ToLookups method. Unfortunately it addes the version information to the lookup and that's why it isn't as usable as it could be.
List<ObjVerEx> relatedCustomers = obj.GetIndirectReferences(Configuration.Structure.Properties.Document, Structure.Objects.Customer); obj.SetProperty(Configuration.Structure.Properties.Customers, MFDataType.MFDatatypeMultiSelectLookup, relatedCustomers.ToLookups() );

Suggestion is to create new ToLookups method which would have boolean parameter which controls should the Lookups contain version number or should it point to the latest version. Same behavior as in the ToLookup method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions