Method for Setting the Search Specification for the Solutions Popup Window Associated with Service Requests
You can use the setPopupSearchSpec() method to specify the search specification for a popup window as shown in the following.
Method Name | Description | Limitations |
---|---|---|
setPopupSearchSpec (popUpBtn, searchSpec) |
Adds a search specification parameter in the HTTP POST request for a popup window. The method adds the parameter if it does not exist, and updates it if the parameter already exists. |
For searchSpec, only the AND operation and String and Picklist fields are supported. |
The parameters for the setPopupSearchSpec() method are as follows:
popUpBtn. The Add button that triggers the popup. You can use the getButton() method to obtain the button, for example:
var addBtn = oraclecrmod.getButton('BTN_TB_SolutionChildList_AddButton')
searchSpec. The search specification for filtering the results returned in the Solutions multiassociation Lookup window. The following shows an example of a search specification:
var searchSpec = "Name='Training' and Status='Approved'"
The length of the search specification must be less than 4096 characters.
The following is an example of how you can use the setPopupSearchSpec() method. The sample code creates a filter for the multiassociation Lookup window that is displayed on clicking the Add button in the Solutions section on the Service Request Detail page. The search specification filters for solutions where the values of the Area, Sub Area 1, and Sub Area 2 fields are equal respectively to the values of the Area, Sub Area 1, and Sub Area 2 fields of the Service Request.
oraclecrmod.onReady(function()
{
if (oraclecrmod.ctx.isObject("Service Request") && oraclecrmod.ctx.isDetailPage())
{
// Define function that sets searchSpec of Solutions popup window
function addMultiAssocSearchSpec()
{
// Get the Area, Sub Area 1, Sub Area 2 fields of the Service Request
var SRArea = oraclecrmod.getField('Area');
var SRSubArea1 = oraclecrmod.getField('ZPick_0');
var SRSubArea2 = oraclecrmod.getField('ZPick_1');
if (SRArea != null && SRSubArea1 != null && SRSubArea2 != null)
{
// ZPick_0, ZPick_1, Z_Pick_2 are the HTML tags of fields Area, Sub Area
// and Sub Area 2 for Solution respectively
setPopupSearchSpec(this, "ZPick_0='" + SRArea.getValue() + "' AND ZPick_1='" + SRSubArea1.getValue() + "' AND ZPick_2='"+ SRSubArea2.getValue()
+"'");
}
}
// Find the Add Solution popup button in the Service Request Page
var addBtn = oraclecrmod.getButton('BTN_TB_SolutionChildList_AddButton');
if (addBtn != null)
{
// When the mouse is over the button update the searchSpec for the button
addBtn.on ("mouseover", addMultiAssocSearchSpec);
}
}
});