YfcMultiSelectToSingleAPIOnAction

Description

This JavaScript function replaces the yfcMultiSelectToSingleAPI() JavaScript function, which has been deprecated.

This function makes a single API call using multiple selections in a list. By default, when an action that calls an API on a list screen is run while multiple selections have been made by the user, the API runs once for each selected record. This function enables you to configure an action that calls an API that runs only once for all selected records.

Attach this function to the action resource. This function creates hidden inputs on the list screen for each record that the user selects. Assuming that the input namespace of the action has been defined correctly, the API is called once and all selected records are passed.

Syntax

yfcMultiSelectToSingleAPIOnAction(checkBoxName, counterAttrName, valueAttrName, keyAttributeName, parentNodePrefix, parentNodePostfix)

Input parameters

checkBoxName - Required. Name of the checkbox object within the JSP where the action is defined.

counterAttrName - Required. Name of the HTML attribute on the checkbox object that contains the counter value that uniquely identifies this row within the table. It is recommended that you always use the string yfcMultiSelectCounter for this parameter.

valueAttrName - Required. Name of the HTML attribute on the checkbox object that contains the value that should be set into the attribute passed in the keyAttributeName parameter. It is recommended that you prefix the value with the yfcMultiSelectValue string. For more details, see the example.

keyAttributeName - Required. Name of the attribute that should be passed to the API.

parentNodePrefix - Required. The portion of the XML binding up to and including the repeating XML element that is to be passed as input to the API.

parentNodePostfix - Optional. The portion of the XML binding between the repeating XML elements of the API input up to the final element in which the attribute specified in the keyAttributeName parameter is to be passed.

Output parameters

None.

Example

This example shows a Create Shipment action that has been defined on a Order Release list view. The following shows how the checkbox object is created within the JSP:

<td class="checkboxcolumn"><input type="checkbox" 
value='<%=getParameter("orderReleaseKey")%>' name="EntityKey" 
yfcMultiSelectCounter='<%=OrderReleaseCounter%>' 
yfcMultiSelectValue1='<%=getValue("OrderRelease",
"xml:/OrderRelease/@OrderReleaseKey")%>' 
yfcMultiSelectValue2='Add'/> 
</td>

Additionally, the Create Shipment action has the JavaScript field set to the following:

yfcMultiSelectToSingleAPIOnAction('EntityKey', 'yfcMultiSelectCounter', 
'yfcMultiSelectValue1', 'OrderReleaseKey', 
'xml:/Shipment/OrderReleases/OrderRelease', 
null);yfcMultiSelectToSingleAPIOnAction('EntityKey', 'yfcMultiSelectCounter', 
'yfcMultiSelectValue2', 'AssociationAction',
'xml:/Shipment/OrderReleases/OrderRelease', null);

Note that the yfcMultiSelectToSingleAPIOnAction function is called twice to create two hidden inputs required by the API.