Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
You can add additional fields to the comments by using a form, Javascript, Process tools and SQL.
As an example, refer to the attached demo app on this page.
<style> .subform-cell.full_width_field { display: none; } </style> <script> $(document).ready(function() { // Select the template to clone var commentTemplate = ` <div class="comment"> <div class="comment_meta"> <a class="comment_user">Admin Admin</a> </div> <div class="comment_date"> Jul 5, 2024, 11:37:43 AM </div> <div class="comment_message twocolumns"> <div class="comment_statusinfo"> <span class="comment_icon"><i class="fas fa-info-circle"></i></span> Status Changed To <strong>Clarification</strong>. </div> <div class="comment_msg"> <span class="comment_icon"><i class="fas fa-comment-dots"></i></span> comment 2 </div> </div> </div> `; $(".comment").remove(); $(".process-comment-container").remove(); // Array to store cloned comments var clonedComments = []; // Find all <tr.grid-row> elements within the tablesaw table $("table.tablesaw.tablesaw-stack").find("tr.grid-row").each(function() { var $row = $(this); // Cache $(this) for performance // Clone the comment template var $comment = $(commentTemplate).clone(); // Get dynamic content from each <tr> var activityCreator = $row.find('span[name="field5_comment_field2_createdByName"]').text().trim(); var userName = $row.find('span[name="field5_comment_field2_user_role"]').text().trim(); var activityName = $row.find('span[name="field5_comment_field2_activityName"]').text().trim(); var statusText = $row.find('span[name="field5_comment_field2_statusKey"]').text().trim(); var commentMessage = $row.find('span[name="field5_comment_field2_message"]').text().trim(); var commentDate = $row.find('span[name="field5_comment_field2_dateCreated"]').text().trim(); // Update cloned comment with dynamic content if (userName !== "") { $comment.find(".comment_user").text(activityCreator + '(' + userName + ')' ); } else { $comment.find(".comment_user").text(activityCreator); } // Update activity name in comment_meta if it exists if (activityName !== "") { $comment.find(".comment_meta").append(' • <span class="comment_activity_name">' + activityName + '</span>'); } $comment.find(".comment_date").text(commentDate); // Check if statusText is not blank before showing comment_statusinfo if (statusText !== "") { $comment.find(".comment_statusinfo").show(); $comment.find(".comment_statusinfo strong").text(statusText); // Update the status text } else { $comment.find(".comment_statusinfo").hide(); } // Check if commentMessage is not blank before showing comment_msg if (commentMessage !== "") { $comment.find(".comment_msg").show().html('<span class="comment_icon"><i class="fas fa-comment-dots"></i></span>' + commentMessage); // Update the comment message } else { $comment.find(".comment_msg").hide(); } // Push the cloned comment to the array in reverse order clonedComments.unshift($comment); }); // Append cloned and customized comments in reverse order to .comments_thread clonedComments.forEach(function(comment) { $(".comments_thread").append(comment); }); }); </script>
This is the javascript code used to clone and modify the comments. Please modify the script based on your use case.
You will need a form that saves records to the {appId}_pd and put the javascript code here.
Go to Approval Activity > Mapping > Clarification > Execute Tool After Return to Clarification Activity > SQL Query
update app_fd_da_pd set c_user_role = "Approver" where id = (select id from app_fd_da_pd where c_recordId = "#form.da_req.id#" order by dateCreated desc limit 1)
Please modify the SQL code based on your needs.
Ultimately you will be able to achieve this, using the demo app. Use the javascript for the red box and process tool + SQL for the green box.
Go to Submit Request to start a run process. You will only need to use admin(1 user) to use this app.