Modifying tblContentProperty/tblWorkContentProperty Select List Items

Vote:
 

I have the need to modify (remove), select list items that are stored in the tblContentProperty/tblWorkContentProperty tables given certain criteria are met.  Trying not to do this directly via SQL.  Is there a way to access these select list items for a particular form if I supply the ID of the parent container of the form or the ID of the element itself?  I know I can use ISelectionFactory to build a form element (select list), but can I also use it to retrieve?  I'm using a scheduled job to do this work.  And would modifying the entries with the select list items affect the drop down lists the way I think they should?  

Thanks,

Tim

#222957
Edited, May 15, 2020 20:00
Vote:
 

As I understand here you are modifying the select items of a Forms element? The element is a content so you can use CMS api to get it out then modify its propertis as you need then call save method. It is for safer than using the SQL directly.

#223851
Jun 05, 2020 7:14
tcooper@portauthority.org - Jun 05, 2020 13:39
Could you elaborate on how I could use the API to do that?
Thanks!
Vote:
 

I am not sure I understand exactly what end result you are trying to accomplish.

You want a dropdown inside a form, but not always show the same items inside that dropdown list? What are the dependencies?

#223853
Jun 05, 2020 7:55
tcooper@portauthority.org - Jun 05, 2020 13:43
Basically want a dynamic drop down list. The items would be removed or hidden and no longer be available to be selected. The list is ultimately a choice of dates for meetings, but I would like the dates to "fall off" so users couldn't select dates that have already passed. That logic is easy. Trying to find the best way to access the list items to apply the logic to.
Thanks!
Vote:
 

If you think a drop-down list is the best suited element, and you want to control the items from code rather than adding them manually, I think creating a data feed is the way to go.

Simply create the datafeed as described here: https://world.episerver.com/blogs/hieu-nguyen-trung/dates/2017/2/create-data-feeds-for-episerver-forms/ and select that data feed from your drop-down list form element.

#223869
Edited, Jun 05, 2020 13:51
tcooper@portauthority.org - Jun 05, 2020 14:26
Thanks! That looks like something I can work with. The problem with that particular example though are the hard coded choices. I need an editor to be able to change the choices year by year when the new meeting dates are known so they can be updated for the website.
I can probably use my query against tblContentProperty/tblWorkContentProperty to get the dates the editors have added initially and then with the datafeed, create a new list of items and remove them as logic defines. Thanks for the suggestion!
Tomas Hensrud Gulla - Jun 05, 2020 16:09
You may add those dates to a configuration page. In the data feed code, read the configuration page and return the values.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.