core icon indicating copy to clipboard operation
core copied to clipboard

Add a way to set categories on workflow

Open jdotcms opened this issue 3 years ago • 2 comments

Currently you can recovery categories from the api, but you can not set the categories to the contentlet in order to be saved.

Acceptance criteria:

After the change a documented approach should exists to set the categories into the contentlet on workflow as a velocity script

Customer ticket: https://dotcms.zendesk.com/agent/tickets/108490

jdotcms avatar Sep 16 '22 17:09 jdotcms

PR

jdotcms avatar Sep 16 '22 18:09 jdotcms

In order to make it works you have to:

  1. create a content type with categories Screen Shot 2022-09-16 at 1 35 49 PM

  2. create a workflow action (velocity script actionlet) Screen Shot 2022-09-16 at 1 32 40 PM


#set($parentCategory = $categories.getCategoryByKey('ageOrGender'))
#set($cats= $categories.getChildrenCategories($categories.getCategoryByKey('ageOrGender')))
#set($contentDeps = $workflow.copyContentletDependenciesBuilder().categories($cats).build())
$workflow.setContentletDependencies($contentDeps))

Create a new type and fire the new action, the categories of age or gender will be assigned to the contentlet

jdotcms avatar Sep 16 '22 18:09 jdotcms

This seems that is already merged in 22.12 but it wasn't QA, so marking as a Priority just to do QA

erickgonzalez avatar Dec 07 '22 23:12 erickgonzalez