fetchParam¶
fetchParam allows dynamically filtering the root list of a tree at runtime. A fetch parameter is set by the user (e.g. via a menu action) and is then applied as a placeholder in the node's query.constraint. This mechanism is currently supported for Maximo backend only.
How it works¶
- A
fetchParamis set via thejsmenu action or fromvalidation/attributeControl. - The stored value is referenced in the node's
query.constraintusing the${fetchParam.<key>}placeholder syntax. - The list is refreshed to apply the new constraint.
query.constraint¶
Reference a fetch parameter inside a node constraint using ${fetchParam.<key>}:
"query": {
"constraint": "HISTORYFLAG=0 AND PARENT IS NULL AND STATUS IN ('${fetchParam.SPECIAL}')"
}
If the parameter holds multiple values (array), all values are expanded into the IN clause automatically.
Functions¶
The following functions are available in the js menu action, validation and attributeControl:
| Function | Description |
|---|---|
setFetchParam(key, value, treeName?) |
Sets the fetch parameter key to value. value can be a string or an array of strings. treeName is optional and defaults to the current tree. Returns a Promise. |
getFetchParam(key, treeName?) |
Returns the current value of the fetch parameter key. treeName is optional and defaults to the current tree. |
removeFetchParam(key, treeName?) |
Removes the fetch parameter key. treeName is optional and defaults to the current tree. Returns a Promise. |
setFetchParam¶
Sets a fetch parameter for the given key. Can be combined with refreshTree to immediately apply the new constraint.
{
"label": "WAPPR",
"icon": "icon-sun",
"action": "js",
"actionValues": [
{
"js": "return setFetchParam('SPECIAL', 'WAPPR').then(refreshTree);"
}
]
}
Multiple values can be passed as an array:
{
"label": "INPRG/WAPPR",
"icon": "icon-sun",
"action": "js",
"actionValues": [
{
"js": "return setFetchParam('SPECIAL', ['INPRG', 'WAPPR']).then(refreshTree);"
}
]
}
To target a specific tree, pass the tree name as the third argument:
{
"label": "WAPPR and goto",
"icon": "icon-sun",
"action": "js",
"actionValues": [
{
"js": "return setFetchParam('SPECIAL', 'WAPPR', 'my-tree-name').then(()=>{refreshTree('my-tree-name')});"
}
],
"then": {
"action": "goto",
"actionValues": [
{
"dstTree": "my-tree-name"
}
]
}
}
getFetchParam¶
Returns the current value of a fetch parameter. Can be used in validation or attributeControl to read the active filter value.
"attributeControl": {
"js": "var current = getFetchParam('SPECIAL'); attribute.readonly = current == undefined;"
}
removeFetchParam¶
Removes a fetch parameter. Use this to clear an active filter and reset the list to its unfiltered state.
{
"label": "Clear",
"icon": "icon-brush",
"action": "js",
"actionValues": [
{
"js": "return removeFetchParam('SPECIAL').then(refreshTree);"
}
]
}
Restrictions¶
- Maximo backend only
- Root nodes only
- Index search cannot apply the fetch parameter constraint — please use searches instead
- Offline search cannot apply the fetch parameter constraint — all downloaded entries will be found regardless of the set parameter