Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Using content Fragment in pathfield how to restrict author not select folder

Avatar

Level 7

In the path field/ asset picker I do not want an author to select any folder, only just the content fragment he should select. Can we do something like this?
Example

Ronnie09_0-1668675140086.png

Author can not select ABC  just this is sample content fragment

2 Replies

Avatar

Community Advisor

Hi @Ronnie09 ,

There is no such OOTB functionality we have in AEM, though you can customize it by script if author select invalid content fragment.

Steps as follow:

  1. Use resourceType: dam/cfm/components/cfpicker
  2. Set some class to fetch it in script eg below
    Screen Shot 2022-11-17 at 10.06.53 PM.png
  3. Implement script which throws error if selects folder.
    Screen Shot 2022-11-17 at 10.11.58 PM.png

Hope that helps!

Regards,

Santosh

 

Avatar

Level 7

@SantoshSai 

I tried something similar but i couldn't achieve writing scripts perfectly. Do you have any sample script . Would help alot