ShowTable of Contents
Within WCM, content can be categorized. Normally, this is used to allow WCM menus to display content related to specific categories. However, it is also possible for users within WCM to have categories associated with their profile. This can be done within theWCM Authoring UI
, the user can select their own categories using a Taxonomy Element
, or can be done programmatically
. Once the user is associated with categories, a WCM menu can then retrieve content that is associated with the same categories as the user.
In this example, we will show how these categories can be used within PZN rules to retrieve the content that is related to the categories that the user is interested in.
Creating and Deploying the Custom Application Object
There are 2 approaches that we can use for this application object. One is to retrieve the values that WCM has associated with the user. This is useful if the end user has categories stored within WCM, the dynamic mapper approach is being used (categories added to WCM Users programmatically), or the end user is selecting their own categories using the taxonomy tree. The other approach is that the custom application object can associate categories for the specific user programmatically. This approach is useful, because categories can selected based on things like user cookies, request attributes in the current request, etc. This particular example will retrieve the categories directly from WCM for the user.
Create the Custom Application Object
Install the Custom Application Object Code
Create the Application Object within PZN UI
Creating the PZN rules
To display the results, we will create a WCM PZN Component in order to reference the rule.
- Navigate to the WCM Authoring UI, open the library that you wish to store the PZN component in.
- Create new -> Component -> Personalization
- Name the component PZN - Current User Category Content
- For the Personalization Element, click New. Create the rule to select Web Content whose category is associated with CurrentUserCatsApp.currentCategoriesUuidString:
- Click Save.
- In the PZN Component, for the Design for each Menu search result, put the following:
[Property type="content" context="autofill" field="title"] - [Property type="content" context="autofill" field="categories"]<br>
This will render the title of the content, as well as the categories that the content is associated with. This will tell us whether the rule is working.
- Save and close the component
Rendering the Results
Now that we have the WCM Component in place, we just have to reference it from a WCM Rendering Portlet.