Use the ApprovalRequiredDroplet
servlet bean to retrieve all orders requiring approval by a given approver. ApprovalRequiredDroplet
queries the order repository and returns all orders that meet the following two criteria:
The order’s
authorizedApproverIds
property contains the approver’s ID.The state of the order requires approval, meaning that the state is defined in the
ApprovalRequiredDroplet
orderStatesRequiringApproval
property. The order’s state is held by the property of the order that is specified in theApprovalRequireDroplet
orderStatePropertyName
property. The default value isPENDING_APPROVAL
.
ApprovalRequiredDroplet
takes the following input parameters:
approverid
: the ID of the current user profile; the approver. This parameter is required.startIndex
: The index of the first order to return. IfstartIndex
is null, then it defaults to 0. This parameter is optional and typically is used to break large result sets into manageable pieces.numOrders
: The number of orders to return on the query. This parameter is optional, and typically is used to break large result sets into manageable pieces.
ApprovalRequiredDroplet
sets the following output parameters:
result
: The array ofOrder
objects.count
: The number ofOrder
objects in theresult
output parameter.totalCount
: The total number ofOrder
objects that satisfied the criteria.nextIndex
: The index of the first order in the next set of results. IfstartIndex
ornumOrders
was null, then this parameter will also be null.previousIndex
: The index of the first order in the previous set of results. IfstartIndex
ornumOrders
was null, then this parameter will also be null.nextIndex
andpreviousIndex
allow the user to cycle back and forth between result sets.startRange
: The 1-based index of the firstOrder
in the set of results.endRange
: The 1-based index of the lastOrder
in the set of results.errorMsg
: The error message to display to the user if an error occurs.
ApprovalRequiredDroplet
renders the following open parameters (oparams
):
output
: Thisoparam
renders the array ofOrder
objects set in theresult
output parameter.empty
: Theoparam
rendered if there are no orders that require approval by the current user.error
: Theoparam
rendered if an error occurs.
Note: The ApprovalRequiredDroplet
servlet bean has a security feature that allows the current user, the approver, to view only the orders of customers for whom he or she is allowed to approve orders. This feature is enabled by default. To disable the feature, set the enableSecurity
property to false.
The following JSP example retrieves from the repository the orders requiring approval by the current user, an approver, and lists each order’s repository ID on the page.
<dsp:droplet name="ApprovalRequiredDroplet"> <dsp:param bean="/atg/userprofiling/Profile.repositoryId" name="approverid"/> <dsp:param value="0" name="startIndex"/> <dsp:param value="10" name="numOrders"/> <dsp:oparam name="output"> <dsp:droplet name="ForEach"> <dsp:param param="result" name="array"/> <dsp:param value="order" name="elementName"/> <dsp:oparam name="output"> <dsp:valueof param="order.repositoryId"/><br> </dsp:oparam> <dsp:oparam name="error"> <dsp:valueof param="errorMsg"/><br> </dsp:oparam> </dsp:droplet> </dsp:oparam> </dsp:droplet>