Combine two result sets with indicators into one view
Requirement: My client wanted to have a dashboard, where user can see all the published knowledge articles reviewed and yet to be reviewed by the user itself.
At first, Created a Choice data type column with logical name as mad_knowledgearticleviewstatus in Knowledge Article table. To show article view status for the user. Here are the options for the same:
Note, I have used icons in the label to show the view status. These icons act as an indicator. Blue icon(🔵) is used for Yet To Be Reviewed status and White icon(⚪) is used for Reviewed status. This field wasn't created to store any data, instead data for this field would be dynamically shown based on the logged in user.
Last step was to show view status based on the user. For that, Registered a plugin on Retrieve Multiple event of Knowledge Article Entity. In the code, simply wrote the condition to set the value for view status column based on data for modifiedby column from Knowledge Article View table. Here is the Complete code:
CRM stores knowledge article views data into Knowledge Article View table.
As per the requirement I have to show two different result sets into one view. One result set for Reviewed and another for Yet To Be Reviewed articles.At first, Created a Choice data type column with logical name as mad_knowledgearticleviewstatus in Knowledge Article table. To show article view status for the user. Here are the options for the same:
Note, I have used icons in the label to show the view status. These icons act as an indicator. Blue icon(🔵) is used for Yet To Be Reviewed status and White icon(⚪) is used for Reviewed status. This field wasn't created to store any data, instead data for this field would be dynamically shown based on the logged in user.
In the next step, Created a simple view in Knowledge Article table to just save it. Later, the view definition was changed in solution customization xml. In the customization xml, for the view, I have linked Knowledge Article View table with outer join instead inner join to get all records (Combining two result sets). modifiedby column in Knowledge Article View table stores the information about the user who viewed the article. Here is the View XML:
Last step was to show view status based on the user. For that, Registered a plugin on Retrieve Multiple event of Knowledge Article Entity. In the code, simply wrote the condition to set the value for view status column based on data for modifiedby column from Knowledge Article View table. Here is the Complete code:
Thanks for sharing this solution
ReplyDelete