We publish a subset of our internal wiki externally now. That note was published a while before 8.11 was released and at the time of posting, this wiki was exclusively for internal audiences. Most of the topics in the wiki are relevant for both audiences but the way we build the apps internally vs externally is different and, to the best of my knowledge, prevents the framework options we have available for our own apps today. I think we need an enhancement to the configuration utility to load this custom lookups.json when trying to perform the validation on the app.xml.
For internal apps, you can define your own lookups.json in the src folder. The JSON file would be in a format like:
{"assetloc": {
"objectName": "MXAPIASSET",
"getList": "location",
"attributeNames": "location,description",
"displayAttributes": "location,description",
"searchAttributeNames": "location,description",
"useSearchTerms": "true"
}}
Another approach suggested to me previously would be importing LookupManager in JavaScript and then trying to add it at runtime. This approach works for our test cases internally but I don't think will ever work for an application (even internal) because the app.xml needs to know about the lookup in order for the application to build. Our build process won't execute the JavaScript to determine that a new lookup has been added via code.
Original Message:
Sent: Mon November 13, 2023 02:39 PM
From: Bartosz Marchewka
Subject: Technician>Asset Lookup on Create WO Screen>How to add a new field to Filter section
Hi @Meghana Siriveli @Steven Shull
There is a chance that soon as IBM wrote in "Developer Documantation" that is available in MAF v8.11 they will describe how to achieve that.
"The lookups.json
file contains predefined maximo lookup defintions that can be used within lookup filters. We provide the opportunity for apps to extend the existing lookups in order to add additiontial ones. Instructions will be added here soon…"
------------------------------
Bartosz Marchewka
Original Message:
Sent: Wed November 01, 2023 09:00 AM
From: Steven Shull
Subject: Technician>Asset Lookup on Create WO Screen>How to add a new field to Filter section
Correct, the filter options for datasources come from all the attributes defined with a lookup-map and those lookup-maps are defined in the lookups.json file to control how the data is fetched and what attributes to display. I haven't tried this for a while but I was never able to successfully define my own using tools available to customers.
The lookups.json is coming from the framework itself and isn't specific to one app. There are some hooks where if you put a lookups.json in your src directory of the application it should load for the application. However, the validation for the configuration utility would still fail because it was evaluating the lookups.json at the framework level and wasn't including this custom version.
There's an alternative way via JavaScript to add a new lookup at runtime but it had similar problems to above. Because the configuration utility didn't know about it, when it went to build the validation failed.
I think you would need to open an idea (https://ibm-ai-apps.ideas.ibm.com/ideas/ ) to try and implement this in a way that customers could add their own.
------------------------------
Steven Shull
Original Message:
Sent: Wed November 01, 2023 02:54 AM
From: Meghana Siriveli
Subject: Technician>Asset Lookup on Create WO Screen>How to add a new field to Filter section
Hello Bartosz,
Thanks for your response.
I am not trying to add fields to Asset Lookup.
There is a Filter Icon available at the left end of the Asset Lookup as below:

The filter Icon open below page within the Asset Lookup.

I am trying to add the fields to this Filter section. And I've observed that lookup-map definition is used OOTB on the fields that are supposed to show up in this Filter section.
Thanks
Meghana S
------------------------------
Meghana Siriveli
Original Message:
Sent: Tue October 31, 2023 01:29 PM
From: Bartosz Marchewka
Subject: Technician>Asset Lookup on Create WO Screen>How to add a new field to Filter section
Hi Meghana,
I checked java script code and it looks like lookups.json file should be (manually?) created as custom file in similar way as AppCustomizations.js file (putting them to src folder).
var customLookupsExist = react.addFileImport('customLookups', './lookups.json', true) !== false;// If the AppCustomizations file exists, then automatically register itvar hasCustomization = react.addFileImport('AppCustomizations', './AppCustomizations.js', true) !== false;
Unfortunately even when I created it in src/lookups.js can't make it working. For me it looks like the file is not loaded.
Maybe @Steven Shull has any tips/idea?
@Meghana Siriveli I'm just thinking if you really need lookup-map definition for additional attribute that you would like to add to: Asset Lookup (id="openCreadWOAssetLookup"). Please observed that non of them (ASSETNUM, DESCRIPTION, LOCATIONDESC) that were used there don't have lookup-map definition.
I was also able to add, for example, ASSET.USAGE (this field definition wasn't there previously) there without any problems and was able to filter assets based on this attribute.
<maximo-datasource id="assetLookupDS" offline-immediate-download="true" lookup-data="true" object-structure="MXAPIASSET" saved-query="MOBILEASSET" selection-mode="single" geometry-format="geojson"> <schema id="d_693"> (...) <attribute name="usage" searchable="true" id="cAssetLookupDSUsage" /> (...) </schema></maximo-datasource>
<lookup-with-filter id="openCreadWOAssetLookup" width="99" datasource="assetLookupDS" on-item-click="chooseAssetItem" show-search="true" show-count="true" has-filter="true" lookup-heading="Assets" enable-barcode-scanner="true"> <list-item id="xw348"> <adaptive-row id="x927p"> <adaptive-column small-width="33" medium-width="33" large-width="15" xlarge-width="15" id="egvg6"> <label label="{item.assetnum}" id="yr9q4"/> </adaptive-column> <adaptive-column small-width="67" medium-width="67" large-width="25" xlarge-width="25" id="k6498"> <label label="{item.description}" id="qpz6x"/> </adaptive-column> <adaptive-column small-width="33" medium-width="33" large-width="15" xlarge-width="15" id="q7x8a"> <label label="{item.locationdesc}" id="zwn4p"/> </adaptive-column> <adaptive-column small-width="33" medium-width="33" large-width="15" xlarge-width="15" id="cAssetLookupUsage"> <label label="{item.usage}" id="cAssetLookupUsageLabel"/> </adaptive-column> </adaptive-row> </list-item> </lookup-with-filter>
------------------------------
Bartosz Marchewka
Original Message:
Sent: Mon October 30, 2023 08:12 AM
From: Meghana Siriveli
Subject: Technician>Asset Lookup on Create WO Screen>How to add a new field to Filter section
We are trying to add a new field in OOTB AssetLookup Datasource(id="assetLookupDS") and then in the filter section on Asset Lookup (id="openCreadWOAssetLookup").
It is observed that OOTB filter attributes are defined using lookup-map in the datasource.
For Ex:
<attribute id="v3by_" name="itemnum" searchable="true">
<lookup-map id="zynjx" name="assetitemnum">
<lookup-return datasource-field="description,itemnum" id="xk98y" lookup-field="displayValue"/>
<lookup-return datasource-field="itemnum" id="eqrw4" lookup-field="value"/>
</lookup-map>
When trying to add lookup-map for the new field , we are getting an error in the App.xml saying that we have to first define the lookup(Ex:assetitemnum) in lookups.json file,But I am unable to find the looksups.json anywhere in our Source code folders.
If anyone here know how to locate the lookups.json, it would be really helpful
------------------------------
Meghana Siriveli
------------------------------