- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2021 02:53 AM
Hello!
I created a 'Create a Normal Change' from the Requested Item. In the Change Request form, I want to add a Requested Item related list that contains the Requested Item. This is similar to the 'Problems', 'Incidents Fixed By Change; related lists.
Please help.
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2021 04:55 AM
Hi ceraulo,
I'll show you how to do this, but I want to make sure you understand the process here. When you create a change from an RITM, the RITM is stored in the parent field of the change_request. This means 2 things 1) you can show the Parent field on the change request form to see the RITM and since it's a reference field you can click through to the RITM, and 2) there's only going to be one RITM per change request created this way, so a related list is not ideal, but this can still be done if the parent reference field is not what you're looking for.
Go to System Definition -> Relationships in the left nav. Create a new record. Name it whatever you want to appear as the Related List name. Applies to table = change_request. Queries from table = task. Your Query with script will simply be this.
(function refineQuery(current, parent) {
current.addQuery('sys_id', parent.parent);
})(current, parent);
Now you can configure your change request form to add your new related list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2021 04:55 AM
Hi ceraulo,
I'll show you how to do this, but I want to make sure you understand the process here. When you create a change from an RITM, the RITM is stored in the parent field of the change_request. This means 2 things 1) you can show the Parent field on the change request form to see the RITM and since it's a reference field you can click through to the RITM, and 2) there's only going to be one RITM per change request created this way, so a related list is not ideal, but this can still be done if the parent reference field is not what you're looking for.
Go to System Definition -> Relationships in the left nav. Create a new record. Name it whatever you want to appear as the Related List name. Applies to table = change_request. Queries from table = task. Your Query with script will simply be this.
(function refineQuery(current, parent) {
current.addQuery('sys_id', parent.parent);
})(current, parent);
Now you can configure your change request form to add your new related list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2021 05:35 AM
Hi Brad,
I tried what you suggested but it did not work. I also checked the Parent field in the Change Request but it wasn't populated. I added this line of code in my UI Action and it worked.
changeRequest.setValue("parent", current.sys_id);
One thing I noticed is in the other related list such as Problems, there are 2 buttons - New and Edit. Any idea how I could do this for my custom related list?
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2021 05:41 AM
for custom defined relationship Edit button is not allowed.
The New or Edit button does not appear on a one-to-many related list
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
03-10-2021 05:57 AM