Skip to content

Support getting custom list field values without having to pass an entry or sense #15

@cdfarrow

Description

@cdfarrow

The current functions, ListFieldPossibilities() and ListFieldPossibilityList() require an entry or sense. Change the interface to allow just the fieldID only, or create new functions.

See this suggested code from Claude AI to get the possibility list without an entry or sense:
def MainFunction(project, report, modifyAllowed):
CUSTOM_FIELD_NAME = "My List Items" # <-- Your original custom field name
cache = project.Cache
mdcm = IFwMetaDataCacheManaged(cache.MetaDataCacheAccessor)
found = False
for flid in mdcm.GetFieldIds():
if mdcm.IsCustom(flid) and mdcm.GetFieldName(flid) == CUSTOM_FIELD_NAME:
guid = mdcm.GetFieldListRoot(flid)
if guid and guid != "00000000-0000-0000-0000-000000000000":
repo = ICmPossibilityListRepository(project)
plist = repo.GetObject(guid)
report.Info(f"Possibility List GUID: {guid}")
report.Info(f"Possibility List Name: {plist.Name.BestVernacularAnalysisAlternative.Text if plist else '(not found)'}")
else:
report.Info(f"Custom field {CUSTOM_FIELD_NAME} does not use a possibility list.")
found = True
break
if not found:
report.Info(f"Custom field {CUSTOM_FIELD_NAME} not found.")

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions