How to display only the choices of state value by sn-record-picker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 01:27 AM
Hello Guys.
I want to use sn-record-picker to filter the value of state
but the display field show all the record of state and it's repeating the value.
I want only to display this 4 "Requested, Awaiting Approval, Closed Complete, Approved "
Please see the attached screenshot.
Can anyone help me?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2022 01:27 PM
Hi,
Did you find any solution on this? I'm also having the same problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2022 03:36 PM
I think the problem is that you are querying your primary table, and not the table of choices. Your query will return every record that contains that state, and you only want one record per state. Try something like this:
<sn-record-picker
table="'sys_choice'"
field="state"
default-query="'name=incident^element=state^inactive=false'"
display-field="'label'"
search-fields="'label'"
value-field="'value'">
</sn-record-picker>
This example is for the Incident table, but you should be able to adapt the idea to your custom table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2022 12:57 PM - edited 11-06-2022 12:58 PM
You're right. Querying the sys_choice table works! Thank you Jeff.