Clickable link needed in portal which direct to the RITM record in native UI

Aravinthakumar
Tera Contributor

Hi,

In the portal catalog item submission page I need a clickable action either in any one of the places mentioned in the below image.

When it is clicked it should direct to the RITM record created in native UI(self service view).

find_real_file.png

 

Is there anyway to achieve this ?

Kindly help me if anyone have any idea.

Thanks in Advance..!!!

1 ACCEPTED SOLUTION

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

Here you go:

1) Clone the widget and then rename it as per your need.

2) Go to html and replace the code with below code:

<div ng-if="data.canRead" class="panel b">
  <div class="panel-heading bg-primary panel-la-jolla-default">
    <div ng-init="spSearch.targetRequests()">
      <sp-c-link target="form" table="data.table" id="data.sys_id"/>
    </div>
    <h2 class="sr-only">${Ticket details}</h2>
    <span ng-if="data.agent" >
      ${Agent working on this {{data.tableLabel}}}:
      <div>{{data.agent}}</div>
    </span>
    <span ng-if="!data.agent && data.agentPossible" >${Your request has been submitted}</span>
    <span ng-if="!data.agentPossible">${{{data.tableLabel}} record details}</span>
  </div>

  <div class="panel-body">
    <dl class="ticket-fields" ng-if="data.fields.length > 0">
        <dt class= "col-md-6 col-sm-12 col-xs-6 break-word" 
            ng-if="field.value && (field.type != 'decimal' || field.type == 'decimal' && field.value != 0)" 
            ng-repeat-start="field in data.fields">{{field.label}}</dt>
        <dd class= "col-md-6 col-sm-12 col-xs-6 break-word" 
            ng-repeat-end ng-switch="field.type" 
            ng-if="field.value && (field.type != 'decimal' || field.type == 'decimal' && field.value != 0)">
           <div ng-switch-when="glide_date_time" title="{{field.display_value}}">
            <sn-time-ago timestamp="::field.value" />
          </div>        
           <div ng-switch-default >
             <span ng-if="field.type == 'string'">
            	<a target="_blank" href="sc_req_item.do?sys_id={{data.sys_id}}">{{field.display_value}}</a>
             </span>
              <span ng-if="field.type != 'string'">
            	{{field.display_value}}
             </span>
             
          </div>
        </dd>
    </dl>
    <div ng-if="data.variables.length > 0" ng-init="c.variable_toggle = true">
      <button class="h4 options-btn btn" ng-click="c.variable_toggle = !c.variable_toggle" aria-expanded="{{c.variable_toggle}}" aria-controls="variables-toggle">
        <span style="font-size: 12px;" class="glyphicon" ng-class="c.variable_toggle ? 'glyphicon-chevron-down' : 'glyphicon-chevron-up'"></span>
        ${Options}
      </button>
      
      <div ng-if="c.variable_toggle" id="variables-toggle" aria-hidden="{{!c.variable_toggle}}">
        <hr role="presentation">
        <div class="m-b break-word" ng-repeat="variable in data.variables | filter:{visible_summary:true}">
          <label class="m-t-xs m-b-none text-muted"><b>{{::variable.label}}</b></label>
          <div ng-if="!variable.multi_row"><!-- variable type 27 corresponds to URL--><span ng-if="variable.type != 27" class="pre-wrap">{{::variable.display_value}}</span><a ng-if="variable.type == 27" class="pre-wrap" title="{{::variable.label}}" href="{{::variable.display_value}}" target="_blank">{{::variable.display_value}}</a></div>
          <div ng-if="variable.multi_row">
             <a href="javascript:void(0)" uib-popover-template="'sp_multirow_vs_summarizer.html'" popover-title="{{variable.label}}"
                     popover-placement="auto left" popover-append-to-body="true" popover-trigger="outsideClick">${Click to view}</a>
          </div>
        </div>
      </div>
    </div>
  </div>

  <div ng-if="data.agentPossible && !data.agent && options.pickup_msg" class="panel-footer">
    <div id="ticket_fields_footer" class="text-center text-muted" style="font-style: italic;" ng-bind-html="data.pickupMsg">
    </div>
  </div>

</div>

 

It will show you something like this:

find_real_file.png

 

Once you click on that it will take you to backend.

Thanks,
Ashutosh

View solution in original post

3 REPLIES 3

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You'll need copy and modify the Ticket Fields widget in order to add a link to the ticket details. 

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

Here you go:

1) Clone the widget and then rename it as per your need.

2) Go to html and replace the code with below code:

<div ng-if="data.canRead" class="panel b">
  <div class="panel-heading bg-primary panel-la-jolla-default">
    <div ng-init="spSearch.targetRequests()">
      <sp-c-link target="form" table="data.table" id="data.sys_id"/>
    </div>
    <h2 class="sr-only">${Ticket details}</h2>
    <span ng-if="data.agent" >
      ${Agent working on this {{data.tableLabel}}}:
      <div>{{data.agent}}</div>
    </span>
    <span ng-if="!data.agent && data.agentPossible" >${Your request has been submitted}</span>
    <span ng-if="!data.agentPossible">${{{data.tableLabel}} record details}</span>
  </div>

  <div class="panel-body">
    <dl class="ticket-fields" ng-if="data.fields.length > 0">
        <dt class= "col-md-6 col-sm-12 col-xs-6 break-word" 
            ng-if="field.value && (field.type != 'decimal' || field.type == 'decimal' && field.value != 0)" 
            ng-repeat-start="field in data.fields">{{field.label}}</dt>
        <dd class= "col-md-6 col-sm-12 col-xs-6 break-word" 
            ng-repeat-end ng-switch="field.type" 
            ng-if="field.value && (field.type != 'decimal' || field.type == 'decimal' && field.value != 0)">
           <div ng-switch-when="glide_date_time" title="{{field.display_value}}">
            <sn-time-ago timestamp="::field.value" />
          </div>        
           <div ng-switch-default >
             <span ng-if="field.type == 'string'">
            	<a target="_blank" href="sc_req_item.do?sys_id={{data.sys_id}}">{{field.display_value}}</a>
             </span>
              <span ng-if="field.type != 'string'">
            	{{field.display_value}}
             </span>
             
          </div>
        </dd>
    </dl>
    <div ng-if="data.variables.length > 0" ng-init="c.variable_toggle = true">
      <button class="h4 options-btn btn" ng-click="c.variable_toggle = !c.variable_toggle" aria-expanded="{{c.variable_toggle}}" aria-controls="variables-toggle">
        <span style="font-size: 12px;" class="glyphicon" ng-class="c.variable_toggle ? 'glyphicon-chevron-down' : 'glyphicon-chevron-up'"></span>
        ${Options}
      </button>
      
      <div ng-if="c.variable_toggle" id="variables-toggle" aria-hidden="{{!c.variable_toggle}}">
        <hr role="presentation">
        <div class="m-b break-word" ng-repeat="variable in data.variables | filter:{visible_summary:true}">
          <label class="m-t-xs m-b-none text-muted"><b>{{::variable.label}}</b></label>
          <div ng-if="!variable.multi_row"><!-- variable type 27 corresponds to URL--><span ng-if="variable.type != 27" class="pre-wrap">{{::variable.display_value}}</span><a ng-if="variable.type == 27" class="pre-wrap" title="{{::variable.label}}" href="{{::variable.display_value}}" target="_blank">{{::variable.display_value}}</a></div>
          <div ng-if="variable.multi_row">
             <a href="javascript:void(0)" uib-popover-template="'sp_multirow_vs_summarizer.html'" popover-title="{{variable.label}}"
                     popover-placement="auto left" popover-append-to-body="true" popover-trigger="outsideClick">${Click to view}</a>
          </div>
        </div>
      </div>
    </div>
  </div>

  <div ng-if="data.agentPossible && !data.agent && options.pickup_msg" class="panel-footer">
    <div id="ticket_fields_footer" class="text-center text-muted" style="font-style: italic;" ng-bind-html="data.pickupMsg">
    </div>
  </div>

</div>

 

It will show you something like this:

find_real_file.png

 

Once you click on that it will take you to backend.

Thanks,
Ashutosh

Hi Ashutosh,

This is what exactly which i am looking for.Its working cool.

 

Thank you so much..!!!