In this guide we are going to look at how we can add comments in a dialer account.


First of all we need to select the Campaign in which we want to add comments, we can do this by selecting it from the dropdown menu on the top left hand corner...





Next we need to go to Campaigns > Form and create a new HTML field. We can do this by selecting the "+" symbol on the right hand side, our suggestion would be to add it underneath the last field where you want it to display.





Now we select HTML





We can now see that it has added the field below, we just need click on the pencil icon to edit the content of that HTML field....





We need to copy and paste the below script...



<div ng-repeat="c in temp.comments">
    <h5><b>{{c.fired| date:'medium'}}</b>  -  {{c.user_loginName}}</h5>
    <p ng-bind-html="c.comment"></p>
</div>



Once done you can click on the pencil icon again to close the HTML box. Now on the newly created HTML field we are going to click on the "+" symbol again and this time select "Start new section"





We can put in a title for this section, for example "Comments"





Once done we click on the "tick" in the top right hand corner to save the settings.


The last step is to add a the below script in the script section....



    data.$comment = "";
  //Old Coments of agents
  var comments = [];
  if (data.$task_log){
    for (var i = 0; i < data.$task_log.length; i++) {
      var le = data.$task_log[i];
      for (var j = 0; j < le.transactions.length; j++) {
        var t = le.transactions[j];
        if (t.comment) {
          var _comment = t.comment.replace(/\\n/g, "<br />");
          t.comment = _comment;
          comments.push(t);
        }
      }
    }
      temp.comments = comments;

      }



This comment needs to be added in the "function onLoad". Functions are normally in the following format....


Any scripts need to go between the "curly braces" ({ })



function onLoad() {
<SCRIPT NEEDS TO GO HERE>
}



What the script is basically doing is that when the form is loaded up it is scrolling through the task log and pulling out the information that has been saved in the "$comment" section and appending it, it then deletes the $comment section so that new comments can be saved.



For any further assistance please contact us at support@megacall.es.