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

API method to filter lookup items based on Filtering Property or Owner?

I Have three Object Types: Country and State where Country Owns State, and Location. I created two Properties, CountryLookup and StateLookupand these are metadata properties of the Location. Am am using the API to populate Locations. The problem I run into is when I need to populate the State, the incoming values are non-unique (ex:FL  for Florida, USA or Flevoland, NLD). So what I need to do is identify that CountriesLookup is the Property on the object that contains the OwnerID, so when I SearchValueListItems, I can see I get two FL results, but that only one is valid for the CountryLookup value.

There are multiple "pairs" of lookups on this object so I am trying to handle this generically. So far it seems very convoluted:

1) Does this PropertyDef's ValueList have an Owner?

2) If Yes, then what other PropertyDef on my object points to the ValueList that holds the Owner values

3) Set OwnerID = the PropertyValue of that other PropertyDef.

This fails when there are two pairs of properties with the same underlying ObjectTypes, example Shipping Address vs Billing Address. I need the Billing State to use the Billing Country and not the Shipping country. I can specify this as a Filter in the property configuration, but I'm not sure how to access that in the API.

Ideas?

Jason

  • When you use SearchForValueListItemsEx2 you can specify a property definition ID.  From recollection this should filter the results out to only those that are valid for that property definition: M-Files API

    Regards,

    Craig.

  • So I figured out two paths to take here. First, if I've defined a filtering relationship between the properties then I can use the DependencyRelationship property to find the parent. Otherwise I need to scan the other properties to see if any use the ValueList that is the same as the owners list. Then I can search for the ValueListItem I need, or do an object search to find the object I need by other properties and then deduce the DisplayId I need.