- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2019 02:18 PM
Hello all,
Recently I added the change request--->parent related list to our incident form. The group who want to use that list need to be able to bulk-add CRs in the related list.
Problem: They click the ADD button in the related list, but in the modal window, they are unable to change the filter to show ALL change requests, including those that are closed (for historical purposes, I suppose).
I see a condition on the "ADD" UI Action button, but I'm afraid I can't figure out what to modify. Is it possible for the filter here to be editable? If so where would I find the seemingly hard-coded filter?
Thanks very much for any assistance
Robin
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2019 01:27 PM
Hi Robin,
The Add UI Action calls the function getURL from the BulkAddChangeRequest script include. This function is responsible for returning the url for the appropriate list view so the Bulk Add feature works appropriately.
The problem you are running into is the url is returning what's called a fixed query. This is a query that the user cannot remove. In order to correct this, you would have to remove the fixed query from the BulkAddChangeRequest script.
I've highlighted the code responsible for this in that script include above.You can modify the code slightly to move the "active=true" condition into the editable query as described below:
getURL: function(){
var sysId = this.getParameter(this.PARAMS.SYSID);
var url = new GlideURL("task_add_change_req.do");
var fixedQuery = "parentISEMPTY";
url.set(this.PARAMS.SYSID, sysId);
url.set(this.PARAMS.VIEW, "default");
url.set(this.PARAMS.NOSTACK, "true");
url.set(this.PARAMS.QUERY, "active=true^ORDERBYDESCsys_created_on");
url.set(this.PARAMS.TABLE, "change_request");
url.set(this.PARAMS.FIXEDQUERY, fixedQuery);
return url;
},
This will make the filter work as you intend:
Take special note though, this is modifying an out of the box Script Include, which could impact you during an upgrade if ServiceNow changes this code. This will be flagged as a conflict / customer edit and the Script Include code will need to be merged manually during the upgrade process.
Thanks,
Ed

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2019 02:39 PM
Use List Control to update related list default filter.
- Right-click a related list column header and click Configure > List Control
- Configure the form to add the Edit default filter field, if necessary.
- Using the condition builder, create a default filter.
- Click Update.
When users click the Edit button in the related list, the list of records they can select is filtered according to the default filter.
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2019 07:14 AM
Hi Sachin, thanks for your suggestion - however my user is wanting to use the ADD button in the related list, not the edit button.
Edit brings them the slushbucket, not what we are after in this case.
Add brings up a modal list of change requests, but the list presented is filtered to active changes only. We need to make this modal present ALL, regardless of state. Can't find the right place to change that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2019 01:27 PM
Hi Robin,
The Add UI Action calls the function getURL from the BulkAddChangeRequest script include. This function is responsible for returning the url for the appropriate list view so the Bulk Add feature works appropriately.
The problem you are running into is the url is returning what's called a fixed query. This is a query that the user cannot remove. In order to correct this, you would have to remove the fixed query from the BulkAddChangeRequest script.
I've highlighted the code responsible for this in that script include above.You can modify the code slightly to move the "active=true" condition into the editable query as described below:
getURL: function(){
var sysId = this.getParameter(this.PARAMS.SYSID);
var url = new GlideURL("task_add_change_req.do");
var fixedQuery = "parentISEMPTY";
url.set(this.PARAMS.SYSID, sysId);
url.set(this.PARAMS.VIEW, "default");
url.set(this.PARAMS.NOSTACK, "true");
url.set(this.PARAMS.QUERY, "active=true^ORDERBYDESCsys_created_on");
url.set(this.PARAMS.TABLE, "change_request");
url.set(this.PARAMS.FIXEDQUERY, fixedQuery);
return url;
},
This will make the filter work as you intend:
Take special note though, this is modifying an out of the box Script Include, which could impact you during an upgrade if ServiceNow changes this code. This will be flagged as a conflict / customer edit and the Script Include code will need to be merged manually during the upgrade process.
Thanks,
Ed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2019 02:04 PM
Ed - thank you sir, that is what I was looking for. I knew it was scripted, just couldn't track it down. Made the change and notated it with comments, so we should be ok if an upgrade flags it. Appreciate the heads up on that as well.
Thanks so much!
Robin