Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
esahaapamaki opened this issue Jan 12, 2024 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@esahaapamaki
Copy link
Contributor

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.

@CraigHawker CraigHawker added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Jan 12, 2024
@CraigHawker
Copy link
Collaborator

Sounds like a great first PR if anyone is interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants