Activity Formatter Help

malu
Tera Contributor

I found that in one of the threads we can have the activity formatter in the UI page as you can see below

find_real_file.png

with this script

UI Macro

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
  3. <link rel="stylesheet" href="/styles/css_includes_ng.cssx"/>
  4. <nav class="navbar navbar-default section_secondary" data-id="991fec850a0006417c9edda2d4e9c487" data-type="section_head">
  5.     <div class="container-fluid">
  6.     <div class="navbar-header">
  7.     <h3 class="form_header">Activity</h3>
  8.     </div>
  9.     <div class="navbar-right">
  10.     <span>
  11.     <button alt="Collapse" title="" class="icon-chevron-right btn btn-icon" tabindex="1" onclick="hideReveal('section'); return false;" data-original-title="Display / Hide"></button>
  12.     </span>
  13.     </div>
  14.     </div>
  15.   </nav>
  16.  
  17.   <g:function record_table="REQUIRED" record_id="REQUIRED" />
  18.   <g:activity sys_id="${jvar_record_id}" fields="" table="${jvar_record_table}"
  19. type="changes" var="jvar_activity"/>
  20. <div id="section" class="h-card-wrapper activities-form col-xs-10 col-md-9 col-lg-8 form-field">
  21.     <j:forEach items="${jvar_activity}" var="jvar_history">
  22.     <li class="h-card h-card_md h-card_comments">
  23.     <div class="sn-card-component sn-card-component_first sn-card-component_meta sn-card-component_meta_sibling">
  24.     <span class="sn-card-component-createdby">${jvar_history.get(0).getValue('sys_created_by')}</span>
  25.     </div>
  26.     <div class="sn-card-component sn-card-component_first sn-card-component_meta">
  27.     <span class="sn-card-component-time">
  28.     <div class="date-calendar">${jvar_history.get(0).getValue('sys_created_on')}</div>
  29.     </span>
  30.     </div>
  31.     <g:activity type="labels" records="${jvar_history}" var="jvar_field_labels"/>
  32.    
  33.     <div class="sn-card-component sn-card-component_records">
  34.     <div class="sn-widget">
  35.     <ul class="sn-widget-list sn-widget-list-table">
  36.    
  37.     <j:forEach items="${jvar_history}" var="jvar_h">
  38.    
  39.     <li>
  40.     <span class="sn-widget-list-table-cell">${jvar_h.getValue('fieldname')}</span>
  41.     <span class="sn-widget-list-table-cell">
  42.     <span>${jvar_h.getValue('newvalue')}</span>
  43.     </span>
  44.    
  45.     <j:if test="${jvar_h.getValue('oldvalue').trim().toString().length()!=0}">
  46.     <span class="sn-widget-list-table-italic ng-scope">was</span>
  47.     <span class="oldValue">${jvar_h.getValue('oldvalue')}</span>
  48.     </j:if>
  49.     </li>
  50.     </j:forEach>
  51.     </ul>
  52.     </div>
  53.     </div>
  54.     <hr/>
  55.   <div class="sn-card-component_accent-bar sn-card-component_accent-bar_dark">
  56.   </div>  
  57. </li>
  58. </j:forEach>
  59. </div>
  60. <script>
  61.   function hideReveal(sectionName) {
  62.   $j("#"+sectionName).toggle("hide");
  63.   $j(".icon-chevron-right").toggleClass("hideBtn");
  64. }
  65. </script>
  66.  
  67. <style>
  68. .oldValue{
  69.   padding-left:5px !important;
  70. }
  71. .hideBtn{
  72.   -webkit-transition: -webkit-transform 0.3s;
  73.   -ms-transition: -ms-transform 0.3s;
  74.   transition: transform 0.3s;
  75.   -webkit-transform: rotate(90deg);
  76.   -ms-transform: rotate(90deg);
  77.   transform: rotate(90deg);
  78.   font-size: 18px;
  79. }
  80. </style>
  81. </j:jelly>

IN UI Page

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
  3. <! record_table holds table name & record_id holds sys_id of record-->  
  4. <g:inline template="custom_activity" record_table="incident"   record_id="<SYS ID OF Your Incident>" />
  5. </j:jelly>

This will show us the activity in a separate UI page , BUT when iam trying to change the code for the below activity formatter it is coming in my UI Page. Any Help

find_real_file.png

Any Help on this?

12 REPLIES 12

malu
Tera Contributor

yes i did the same BUT i can see <g:activity in the script which pulls only the acitivities from the table but here in the baseline diff its a different formatter. How can i achieve this in UI macro.


find_real_file.png


malu
Tera Contributor

Any idea on this formatter?


Okay, So you are saying that .... you want a formatter for a different table but not baseline diff. Do you want it for incident table ?


malu
Tera Contributor

No, I want it for baseline Diff.


Actually Iam trying to pull out the activity values( like Basic attribute changes and Relationship value changes) as shown in screenshot above under Base line Difference to a field called comments in UI page which i created.


Okay   got it ... so need further customization of the code. I could suggest the place where you need to make changes but you need to modify code and troubleshoot.


Please look into below code part .. .this code retrieving all fields captured in history in a loop... customize accordingly ... like add a if statement inside loop ....


if jvar_h.getValue('fieldname') == comments



<j:forEach items="${jvar_history}" var="jvar_h">


  •    
  •     <li>
  •     <span class="sn-widget-list-table-cell">${jvar_h.getValue('fieldname')}</span>
  •     <span class="sn-widget-list-table-cell">
  •     <span>${jvar_h.getValue('newvalue')}</span>
  •     </span>
  •    
  •     <j:if test="${jvar_h.getValue('oldvalue').trim().toString().length()!=0}">
  •     <span class="sn-widget-list-table-italic ng-scope">was</span>
  •     <span class="oldValue">${jvar_h.getValue('oldvalue')}</span>
  •     </j:if>
  •     </li>
  •     </j:forEach>