Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

Hi @Mohith Devatte 

Any Update /Suggestions on this let me know.