- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2022 09:10 AM
We want to add the request short description to the Request Summary page. I have cloned the SC Order Status widget and replaced it with my cloned version on the Request Summary page.
I suspect I need to add it to this section of the server script but nothing I try seems to work; that is, nothing shows.
data.request = {};
data.showPrices = $sp.showCatalogPrices();
data.request.id = sc_request.getID();
data.request.submitted_on = sc_request.getOpenedAt();
data.request.number = sc_request.getRequestNumber();
data.request.esimated_delivery = sc_request.getLongestDueDate();
data.request.requested_for = sc_request.getRequestedFor();
data.request.opened_by = sc_request.getOpenedBy();
data.request.show_estimated_delivery = false;
data.request.show_requested_for = sc_request.canShowRequestedFor();
data.request.universal_request = sc_request.getUniversalRequestNumber();
I was able to add short description to the requested items list but I really just want to add the request short description to the header area under Request Number.
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2022 08:10 AM
The solution is cloning the widget responsible of displaying the Request details and replacing the original SN widget on the page with the cloned, customized one.
Once one cloned the widget, the Body HTML template should be augmented by adding the artifacts necessary to display the short description (aprox. around line 30):
...
${Request Number} : <b>{{::data.request.number}}</b>
</div>
<div class="text-muted" ng-if="data.request.short_description">
${Request Short Description} : <b>{{::data.request.short_description}}</b>
</div>
<div class="text-muted" ng-if="data.request.universal_request">
${Universal Request Number} : <b>{{::data.request.universal_request}}</b>
...
Of course the new div can be placed a bit higher or lower, as desired.
Next functionality has to be added that loads the needed data. For that the Server script has to be modified, by adding a new property to object request (aprox. around line 70):
...
data.request.id = sc_request.getID();
// The line below is the new line inserted
data.request.short_description = getTaskShortDescription(data.request.id);
data.request.submitted_on = sc_request.getOpenedAt();
...
and for sure the referenced function also needs to be defined, anywhere (in a syntactically correct position) in the Server script:
function getTaskShortDescription (uniqueValue) {
var gr = new GlideRecord('task');
return gr.get(uniqueValue) ? '' + gr.short_description : null;
}
I have done these modification in my PDI, and here is the result (I have left the original widget too on the page for comparison):
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2022 12:19 PM
Usually Short description on Requests is not set (say you submit a Cart containing a request for a Phone a Conference room reservation and a new Access in SAP. What would be the short description? Just because 99% of the cases a Request has one Requested Item and a Requested Item has one Catalog Task, that does not mean the Request process is built for that scenario, quite the contrary.
What I'm trying to say is perhaps there is no point in displaying Request Short description.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2022 03:30 AM
Thank you but for us, that is not the case. We use short description to provide a way to distinguish requests. For example, we have a service catalog log item named Report Modification Request. We use information from the user (i.e., the name of the report) to put in the short description. This allows us to identify requests at the list level. That is, the request list would show the short description which would show the following as an example:
REQ888888 Report Modification Request for Report 1
REQ999999 Report Modification Request for Report 2
etc
It would be helpful to display this field (or any other request field as appropriate) with request number on the Request Summary page. I haven't figured out a way to do this. I have seen a similar question where someone wanted to display priority here but it doesn't appear that a solution was posted for this.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2022 08:10 AM
The solution is cloning the widget responsible of displaying the Request details and replacing the original SN widget on the page with the cloned, customized one.
Once one cloned the widget, the Body HTML template should be augmented by adding the artifacts necessary to display the short description (aprox. around line 30):
...
${Request Number} : <b>{{::data.request.number}}</b>
</div>
<div class="text-muted" ng-if="data.request.short_description">
${Request Short Description} : <b>{{::data.request.short_description}}</b>
</div>
<div class="text-muted" ng-if="data.request.universal_request">
${Universal Request Number} : <b>{{::data.request.universal_request}}</b>
...
Of course the new div can be placed a bit higher or lower, as desired.
Next functionality has to be added that loads the needed data. For that the Server script has to be modified, by adding a new property to object request (aprox. around line 70):
...
data.request.id = sc_request.getID();
// The line below is the new line inserted
data.request.short_description = getTaskShortDescription(data.request.id);
data.request.submitted_on = sc_request.getOpenedAt();
...
and for sure the referenced function also needs to be defined, anywhere (in a syntactically correct position) in the Server script:
function getTaskShortDescription (uniqueValue) {
var gr = new GlideRecord('task');
return gr.get(uniqueValue) ? '' + gr.short_description : null;
}
I have done these modification in my PDI, and here is the result (I have left the original widget too on the page for comparison):
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2022 05:27 AM
Thank you!