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

shloke04
Kilo Patron

Hi,

i don't think this is possible as a single REQ can have multiple RITM records and RITM is a child table to REQ so you will not be able to dot walk in as well and show the item name here.

You can configure another list to be shown on your portal where you can display the RITM directly and add ITEM column in List view which you want, but cannot display it in Request list.

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

Nisha28
Tera Contributor

Hello Shloke

Thanks for your reply , Can we achieve these through business rule by setting the short description on request by the RITM catalog item name.

There we can display all the cat item name and setting them in short description and that short description can be use in list view in portal.

 

Please le me know is these is correct or not

Yes, technically this is possible.

What you can do here is write a After Insert Business Rule on Requested item table and use the script below:

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

Nisha28
Tera Contributor

Hello Sholke,

 

This script is not working at all it is not going inside the loop can you please help on this

Thanks