Put the last tracking note of a solution in a field soln_lastnote

Hi,
I want to display on a Solution a field "Last Note" (soln_lastnote from the table Solutions) which would contain the last tracking note (Soln_ProgressNote from the table SolutionsProgress).

When someone uses the Workflow and updates a Solution, I want the field Last Note to be updated and displayed immediately.

How can I do that?


Thanks in advance.

  • 0

    I found the solution:

    I wrote a Table Level Script in the table SolutionsProgress.

    Here is my code:

    function InsertRecord()

    {

    }

    function PostInsertRecord()

    {

    var currentSolutionId = CRM.GetContextInfo("Solutions","Soln_SolutionId");

    if(currentSolutionId != null)

    {

    var currentSolutionProgress = CRM.FindRecord("SolutionsProgress",WhereClause);

    var newTrackingNote = currentSolutionProgress.Soln_ProgressNote;

    // if newTrackingNote is undefined (is empty), clear the field soln_lastnote.

    if (newTrackingNote == null)

    {

    var updateSql = "UPDATE Solutions SET soln_lastnote = '' WHERE Soln_SolutionId = '"+currentSolutionId+"'";

    CRM.ExecSql(updateSql);

    }

    else

    {

    var updateSql = "UPDATE Solutions SET soln_lastnote = '"+newTrackingNote+"' WHERE Soln_SolutionId = '"+currentSolutionId+"'";

    CRM.ExecSql(updateSql);

    }

    //ErrorStr = "newTrackingNote = currentSolutionProgress.Soln_ProgressNote = ("+newTrackingNote+"), soln_lastnote updated.";

    }

    }

    function UpdateRecord()

    {

    }

    function DeleteRecord()

    {

    }