Setting CMS record’s “Hidden From Site” / “Visible on Site” thru custom velo code

Question:
Can I set a CMS record’s “Hidden From Site” / “Visible on Site” thru custom Velo code.

Product:
I am using Wix editor, CSM and some velo coding.

There is a system field on CMS records to indicate whether that record is hidden or shown in datasets for display. (Internally it looks like there are actually 2 dates used for this.) I would like to adjust that control using LOAD/UPDATE HOOKS, depending on some of the other fields on the record. (eg if field1 is empty or field2 = ‘x’, then set to “Hide”.) I do not see a field-name to reference this indicator (or the dates).

Can this be done using custom code?

I have tried using dataset filters on the field1 and field2 fields but when using dynamic page scrolling forward and backward seems to ignore my filtering. Only those system hide/show mechanism really blocks them out. Besides, if I can manipulate those hide/show fields in one place I need not worry about it every time I use that collection.

Thanks

Have you tried show() and hide()? Please refer to:

Hi; Thanks for you response. I am aware of that API but it works against a particular ELEMENT. I have used that to hide or show a button, or message showing on the screen. I am taking about the functionality which I now see is called “Status of item visibility” - ie at the collection item level. If you were listing all items (records) in a collection, this Status flag would determine whether the whole record would be included. WIX offers it at an option for every CMS Collection and shows up in CMS as if this was a field .

Thanks for your respons

I’m pretty sure that is not available. My workaround has been to have a boolean field in the collection.

Thanks, I agree that this might not be doable. I have searched everywhere for anyone who has done it with no luck, and played with code on my sandbox to actually change the field contents - but now luck either. It seems like those system fields are protected from being messed with. And I know it’s usually better to use a workaround like you’re suggesting then do something “unsupported”, even if you can get it to work. That will come back to haunt you in the next release etc.
Again Thanks.