- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2022 01:35 AM
I want to create the related list(Relationship) on change table as approval-attachment and it should shows the attachments attached while approving and rejecting the change request.
Solved! Go to Solution.
- Labels:
-
Service Desk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2022 04:45 AM
this worked for me
CHG -> has 1 file
Approval record has 1 file
Total 2 records shown in related list
(function refineQuery(current, parent) {
// Add your code here, such as current.addQuery(field, value);
// get the approval records for this CHG
var app = [];
var gr = new GlideRecord("sysapproval_approver");
gr.addQuery("sysapproval", parent.getUniqueValue());
gr.addQuery("source_table", "change_request");
gr.query();
while(gr.next()) {
app.push(gr.getUniqueValue());
}
app.push(parent.sys_id.toString());
current.addQuery("table_sys_id" ,"IN", app.toString());
})(current, parent);
Please mark my response as correct and close the thread
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2022 02:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2022 02:47 AM
Please use the script I shared and share me the update.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2022 03:08 AM
Hi Ankush,
Still it is not working. I attached the file on approval record but still in related list there is no record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2022 04:33 AM
Hi,
can you share your script and configuration?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2022 04:45 AM
this worked for me
CHG -> has 1 file
Approval record has 1 file
Total 2 records shown in related list
(function refineQuery(current, parent) {
// Add your code here, such as current.addQuery(field, value);
// get the approval records for this CHG
var app = [];
var gr = new GlideRecord("sysapproval_approver");
gr.addQuery("sysapproval", parent.getUniqueValue());
gr.addQuery("source_table", "change_request");
gr.query();
while(gr.next()) {
app.push(gr.getUniqueValue());
}
app.push(parent.sys_id.toString());
current.addQuery("table_sys_id" ,"IN", app.toString());
})(current, parent);
Please mark my response as correct and close the thread
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader