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

This thread shows the securing the activity formatter. I need to pull the values from baseline differences as you can see below when i select baseline from my UI Page.


Example: My UI Page...When i select the baseline the below Comments field should show the values from CMDB Baseline differences for the selected Basline.


find_real_file.png


find_real_file.png



Above comments field should show the below Relationship Changes in the same format.


find_real_file.png


Any help


Any Ideas??


HI Ravi,



The name of the macro should be custom_activity and please make sure that you are providing two required parameters while calling this ui macro


<g:inline template="custom_activity" record_table="incident" record_id="<SYS ID OF Your Incident>" />