How to add a field "Number of views" for a Solution

Hello, I would like to add a field "Views" or "Number of views" on each Solution. This field must be incremented each time someone sees the solution.
In order to see the most viewed solutions, the most popular.

How can I increment it? Can a script be triggered when a solution is opened (viewed)?

  • 0

    Hi,

    Are you viewing the solutions through CRM? Try this:

    1: Add a new numeric field called soln_viewcount to the Solutions entity. It's optional whether you want to add it to the SolutionDetailBox for when you're viewing the solution.

    2: Add the following as a Create Script to any field on SolutionDetailBox:

    var currentSolution = CRM.FindRecord("Solutions", "soln_solutionid=" + CRM.GetContextInfo("solutions", "soln_solutionid"));

    if(isNaN(currentSolution.soln_viewcount)) {

    currentSolution.soln_viewcount = 1;

    }
    else {

    currentSolution.soln_viewcount = parseInt(currentSolution.soln_viewcount) + 1;

    }

    currentSolution.SaveChanges();


    Hope this helps,
    Rob

  • 0

    Thank you very much this really helps !