Associated SCTASKS for RITM

Akhil42
Tera Contributor

Hi Everyone,

 

I have created a widget where it displays all the associated SCTASKS. I have added that widget in one of the page and it is working as expected.

Akhil42_0-1691747523007.png

 

 

But when I added this widget to ticket tab configuration it is showing as empty

Akhil42_1-1691747523315.png

 

 

Code of Widget:

HTML: 

<div class="container">
<div class="row">
<div class="col"><strong>Task Number</strong></div>
<div class="col"><strong>Short Description</strong></div>
<div class="col"><strong>State</strong></div>
<div class="col"><strong>Assigned To</strong></div>
<!-- Add more field names here -->
</div>

<div class="row" ng-repeat="task in data.catalogTasks">
<div class="col">{{ task.number }}</div>
<div class="col">{{ task.short_description }}</div>
<div class="col">{{ task.state }}</div>
<div class="col">{{ task.assigned_to }}</div>
<!-- Add more field values here -->
</div>
</div>

 

CSS:

<style>
.container {
display: flex;
flex-direction: column;
border: 1px solid #ccc;
padding: 10px;
}

.row {
display: flex;
flex-direction: row;
justify-content: space-between;
border-bottom: 1px solid #ccc;
padding: 5px;
}

.col {
flex-basis: 20%; 
padding: 5px;
}

.col:first-child {
flex-basis: 10%; 
}
</style>

 

Server Script:

(function() {
    var ritmSysID = $sp.getParameter('sys_id'); // Get the RITM Sys ID from the URL parameter
    var result = [];

    var grCatalogTask = new GlideRecord('sc_task');
    grCatalogTask.addQuery('request_item', ritmSysID);
    grCatalogTask.query();

    while (grCatalogTask.next()) {
        var taskDetails = {
            number: grCatalogTask.number.getDisplayValue(),
            short_description: grCatalogTask.short_description.getDisplayValue(),
            state: grCatalogTask.state.getDisplayValue(),
            assigned_to: grCatalogTask.assigned_to.getDisplayValue(),
        };
        result.push(taskDetails);
    }

    data.catalogTasks = result;
})();
 
Client Script:
api.controller=function() {
  /* widget controller */
  var c = this;
};
 
ScreenShot of Tab Configuration:
Akhil42_2-1691747523009.png

 

 

Can anyone please give me some suggestion that how can I show those details in Tab Configuration.

 

Thanks in advance,

Akhil.

5 REPLIES 5

Mohith Devatte
Tera Sage
Tera Sage

Hello @Akhil42 ,

So you are using $sp.getParameter() right ? in the URL of the ticket page does it contain the RITM sys_id in sys_id parameter ? 

Hi @Mohith Devatte ,

When I opened the RITM in the page I am able to see those associated tasks of RITM as per widget code, but not in Ticket Tab configuration (Task detail2)

Akhil42_1-1691748879528.png

 

Could you please suggest me what parameters needs to be passed in the ticket tab configuration.

Akhil42_0-1691748848789.png

 

@Akhil42 let me try this in my PDI in some time and will get back to you 

@Mohith Devatte Thanks for the help.