SC Order Status add request short description

mah1
Kilo Sage

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.

 

find_real_file.png

Thank you.

1 ACCEPTED SOLUTION

-O-
Kilo Patron
Kilo Patron

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):

find_real_file.png

View solution in original post

6 REPLIES 6

-O-
Kilo Patron
Kilo Patron

You're welcome!

-O-
Kilo Patron
Kilo Patron

And for sure using the same method one can display pretty much anything, but of course needs to mind information overload in form crowding :-).