Can a Smart Table's Entity-Referenced Property Use a Query to Filter Candidates by Default?

Hello,

I’m configuring a SmartTable to define custom hold rules, where users can specify a hold reason based on given conditions.

Currently, when editing the SmartTable, the entity picker lists all active Reason entries, including those with Type values other than Hold. While users can manually apply an advanced filter with a saved query, it would be much better if the selection list showed only the qualified candidates by default — such as those where Type = Hold through table definition.

Is there a way to apply a default query or filtering logic to an Entity Type property within the SmartTable definition, so that the entity picker is pre-filtered when selecting values?

Thanks!

Timmy.


Hello Timmy,

This is actually something that can be achieved via customization, though the documentation could be improved. If memory serves me correctly, this is what you need to do:

  1. Add an entry to the ContextResolution Generic Table (ex.: DataResolution → CustomDataContext)

  2. On a UI customization package, navigate to its metadata.service.ts file and locate (or add) the **entityTypes **getter which allows you to define extra views (which is a common use case), but also context tables

EDIT: Looks like my previous got cut off and didn’t display the image correctly

Hello Timmy,

This is actually something that can be achieved via customization, though the documentation could be improved. If memory serves me correctly, this is what you need to do:

  1. Add an entry to the ContextResolution Generic Table (ex.: DataResolution → CustomDataContext)

  2. On a UI customization package, navigate to its metadata.service.ts file and locate (or add) the entityTypes getter which allows you to define extra views (which is a common use case), but also context tables

  3. On the contextTables property define something like this:
    Hope it helps.

Best regards,
António Sousa

Hello António,

Thanks for providing the solution, though there are some key points I couldn’t figure how it works, please allow me to further clarify my scenario and trying on the suggested solution.

SmartTable CustomHoldRule

Table Definition

Suggested Solution

  1. Add an entry to the ContextResolution Generic Table (ex.: DataResolution → CustomDataContext)

GT ContextResolution

  • ResolutionType: DataResolution

  • EntityType: N/A, or should be a custom key value like CustomHoleRuleReason?

  • ResolveSmartTableName: CustomDataContext

  • What’s the key(s) and value for smart table CustomDataContext?

  1. On a UI customization package, navigate to its metadata.service.ts file and locate (or add) the entityTypes getter which allows you to define extra views (which is a common use case), but also context tables

  2. On the contextTables property define something like this:

The metadata I’m currently have

I’m quite unfamiliar with the context resolution table (as well as the contextTable in GUI’s metadata, only fiddled with the views), knowing it allow us to override the resolution context smart table with our own, the mechanism you provide gives insight to new capabilities.




Hello António, Thanks for your reply, please see the response in the answer for better formatting and readability.