- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2022 09:25 AM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2022 06:55 AM
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:
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
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2022 06:25 AM
(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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2022 06:55 AM
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:
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
Regards,
Shloke