Maximo Anywhere - Lookup Filter issue

724 Views Asked by At

I am working on Maximo Anywhere 7.5.2 (Work Execution app). I need to filter the lookup values based on some conditions within Anywhere.

Ex: Lets consider, I have textfield which can have A or B value only, If it is A from Maximo, then the lookup field should show (P,Q,R,S) and if it is B, Lookup should show (P,Q) only.

1

There are 1 best solutions below

0
On BEST ANSWER

This is trickier than you think, because you'll need to write your own code to execute to filter the subsequent lookup. For an example you can look at this code in WODetailHandler.filterAssetForLookup method.

filterAssetForLookup: function(eventContext){

        var additionalasset = CommonHandler._getAdditionalResource(eventContext,'additionalasset');
        additionalasset._lookupFilter = null;

        //save the current asset so we can reset it if the user has to revert the value
        var workOrderSet = CommonHandler._getAdditionalResource(eventContext,"workOrder");
        if(workOrderSet.getCurrentRecord() != null){
            this.curAsset = workOrderSet.getCurrentRecord().get("asset");
            this.curAssetDesc = workOrderSet.getCurrentRecord().get("assetdesc");
            this.curAssetld = workOrderSet.getCurrentRecord().get("assetld");
        }

        var siteid = CommonHandler._getWorkorderSiteId(eventContext);
        if(siteid == null){
            siteid = UserManager.getInfo("defsite");
        }

        var filter = [];

        filter.push({siteid: siteid});

        additionalasset.lookupFilter = filter;          
    },

Then you attach this filter in the filterMethod in the app.xml.

<lookup filterClass="application.handlers.WODetailHandler" filterMethod="filterAssetForLookup" id="WorkExecution.AssetLookup" label="Select Asset" resource="additionalasset">