Display Item name from RITM when click on View All in Open Request in service portal

Nisha28
Tera Contributor

Hello 

I want to display Item name from RITm on request when we click on View All in open request in service portal.

widget is Data Table from URL Definition 

Please find the attached screen shot . I want to show the Item name in short description .

Please let me know How we can achieve

 

1 ACCEPTED SOLUTION

Hi Nisha,

Your script looks incorrect to me for your scenario. Please refer to the script shared above by me. That will work and I have tested it as well.

Sharing it below for your reference again:

If it does not work then please share your version of code along with screenshot after making it similar to mine and let me know.

BR Details:

Table Name: Requested Item(sc_req_item)

When: After Insert

Script:

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var gr = new GlideRecord('sc_request');
	gr.addQuery('sys_id',current.request);
	gr.query();
	if(gr.next()){
		if(JSUtil.nil(gr.short_description)){
			gr.short_description = current.getDisplayValue('cat_item') + '\n';
		}else if(JSUtil.notNil(gr.short_description)){
			gr.short_description += current.getDisplayValue('cat_item');
		}
		
		gr.update();
	}

})(current, previous);

Screenshot as well for reference:

find_real_file.png

This will show the Catalog item Name in your portal as well.

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

6 REPLIES 6

Nisha28
Tera Contributor

(function executeRule(current, previous /*null when async*/) {

var notes = [];

var gr = new GlideRecord("sc_req_item");
gr.addQuery("request", current.sys_id);
gr.query();
while (gr.next()) {
notes.push(gr.cat_item.name.toString() + '\n');
}

current.description = notes.toString();
current.update();
})(current, previous);

 

This code is working but in portal i am not getting the full description means if 3 item is coming in the description then in portal description only one is getting populated .

Please find the below screen shot

 

Hi Nisha,

Your script looks incorrect to me for your scenario. Please refer to the script shared above by me. That will work and I have tested it as well.

Sharing it below for your reference again:

If it does not work then please share your version of code along with screenshot after making it similar to mine and let me know.

BR Details:

Table Name: Requested Item(sc_req_item)

When: After Insert

Script:

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var gr = new GlideRecord('sc_request');
	gr.addQuery('sys_id',current.request);
	gr.query();
	if(gr.next()){
		if(JSUtil.nil(gr.short_description)){
			gr.short_description = current.getDisplayValue('cat_item') + '\n';
		}else if(JSUtil.notNil(gr.short_description)){
			gr.short_description += current.getDisplayValue('cat_item');
		}
		
		gr.update();
	}

})(current, previous);

Screenshot as well for reference:

find_real_file.png

This will show the Catalog item Name in your portal as well.

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke