Let guest user in Salesforce community vote on articles, and see results in a custom object
- Lightning Knowledge is enabled
- Single language
-
Install package (Production/DE | Sandbox), or clone the repository and push/deploy source to the target org.
-
Put
Article Vote for Guest Users
on Article Detail page of your community. -
Set Record Id to
{!recordId}
on the component setting. -
(If necessary) Change message and label on the component setting.
-
If you enabled
Allow voting on articles
in standard Article Content component, make sure that this vote component is visible for only guest users.
- Allow the guest user profile to access
GuestArticleVoteController
Apex class.
Vote result is stored in GuestArticleVote__c
custom object. This custom object has the following fields. Create a report of this object for your knowledge improvement lifecycle.
- Knowledge : Lookup to Knowledge Article Version (NOTICE: Make sure to select 'Read-Only' when you modify this field to master-detail)
- Guest User Id : Unique Id for guest users. This value is saved to cookie on guest users' browser to avoid duplicate vote.
- Upvoted? : Checked if upvoted.
Based on the idea "Let UNAUTHENTICATED community users vote on articles when using Napili Template". In classic, PKB by Salesforce Labs is available but it won't be updated and Lightning Knowledge is not supported.
Feature requests, bug reports and pull requests are welcome!
The source code is licensed under the MIT license