- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2021 01:20 AM
Hi,
I've created an "Add" button for a related list in Agent Workspace that display all Locations.
However I need only to display Locations type Country.
How can I achive that?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2021 03:00 AM
Hi Nico,
you have to create an extension point.
First enter the name of the new extension point at Action Attribute "extensionPoint"
Then go to module "Scripted Extension Points" and open "global.RelatedListItemCandidateFilter":
At related links section click on "Create Implementation" to create a Script Include which will represent the extension:
You can name the Script Include as you like. Important are
- Accessible from = "All application Scopes"
- check at line 9 for "MY_EXTENSION"
- business logic for filtering the given records for selection
After opening selection dialog again you can see that the country column is prefiltered:
Kind regards
Maik
If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2021 03:49 AM
In this case, each related list need different conditions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2021 05:39 AM
Hi Maik i have the similar requirement but i want to display the add relation button on few tables only like incident ,case,problem.So how can i achieve this:
my extension point is as follows:
var TaskRelTaskCandidateFilter = Class.create();
TaskRelTaskCandidateFilter.prototype = {
initialize: function(tableName, parentFieldName, parentRecordSysId, referencedFieldName) {
this.tableName = tableName;
this.parentFieldName = parentFieldName;
this.parentRecordSysId = parentRecordSysId;
this.referencedFieldName = referencedFieldName;
},
getFilterQuery: function() {
var selectedRecord = new GlideRecord(this.tableName);
//selectedRecord.addEncodedQuery("this.tableName='incident'^ORthis.tableName='sc_req_item'");
selectedRecord.addQuery(this.parentFieldName, this.parentRecordSysId);
selectedRecord.query();
var result = [];
while (selectedRecord.next()) {
result.push(selectedRecord.getValue(this.referencedFieldName));
}
if (result.length)
return "sys_idNOT IN" + result.join(",");
return "";
},
handles: function(thing){
return thing == "sap_add_relation";
},
type: 'TaskRelTaskCandidateFilter'
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2023 08:39 AM
Hi Maik,
This was indeed very helpful in my use case.
What we want is, certain condition to be default on form load but allow user to update/edit filters later as per need.
In the screenshot you can see the filters are empty so adding new filter just return 'No record' as the filter mentioned in script include is still being applied.
Thanks,
Shubhanshu