I asked Grok. Hope it helps.
In Aware IM, when using a PICK ONE OR MORE action within a process, the selected records are typically stored in a multiple reference attribute or a temporary collection that you can access after the user makes their selection. To check how many records the user has selected and enforce a limit (e.g., preventing selection of too many records), you can add logic in your process to count the selected records and take appropriate action.
Here’s how you can approach this:
Steps to Check the Number of Selected Records
Understand the Context of PICK ONE OR MORE:
When you use PICK ONE OR MORE in a process, the user selects records from a query or list, and those selections are returned to the process. The selected records are usually stored in a multiple reference attribute of the business object tied to the process or in the CurrentObject if it’s a single instance with a multiple reference.
Use COUNT to Get the Number of Selected Records:
After the PICK ONE OR MORE action, you can use the COUNT function in Aware IM’s rule language to determine how many records were selected.
Add Validation Logic:
Once you have the count, you can compare it to your desired limit (e.g., 1 or a "few" like 5) and display a message or cancel the process if the user selects too many.
Example Process
Assume you have a business object MyObject with a multiple reference attribute SelectedItems that holds the records chosen via PICK ONE OR MORE. Here’s how you might write the process:
PROCESS CheckSelectionLimit
PICK ONE OR MORE FROM MyQuery INTO MyObject.SelectedItems
IF COUNT(MyObject.SelectedItems) > 5 THEN
DISPLAY MESSAGE 'You have selected too many items. Please select 5 or fewer.'
CANCEL PROCESS
ELSE
// Proceed with the rest of the process
DISPLAY MESSAGE 'You selected ' + COUNT(MyObject.SelectedItems) + ' items. Processing continues.'
END
Explanation
PICK ONE OR MORE FROM MyQuery INTO MyObject.SelectedItems: This prompts the user to select records from MyQuery, and the selected records are stored in the SelectedItems attribute.
COUNT(MyObject.SelectedItems): This returns the number of records in the SelectedItems collection.
IF COUNT(...) > 5: Checks if the number of selected records exceeds your limit (e.g., 5). Adjust this number as needed.
DISPLAY MESSAGE: Informs the user if they’ve selected too many records.
CANCEL PROCESS: Stops the process if the limit is exceeded.
ELSE: Continues the process if the selection is within the allowed limit.
Preventing "Select All" or Bulk Selection
Unfortunately, Aware IM doesn’t provide a direct built-in option to disable the "select all" checkbox in the PICK ONE OR MORE dialog out of the box. However, you can:
Limit the Query: Pre-filter the query (MyQuery in the example) to show fewer records, reducing the chance of accidental bulk selection.
Custom Form (Advanced): If you need more control, replace PICK ONE OR MORE with a custom form where you display the records in a grid and use a script to enforce selection limits (e.g., via JavaScript in the form). This requires more effort and knowledge of Aware IM’s customization options.
Post-Selection Check: Rely on the process logic (as shown above) to catch and handle excessive selections after the fact, which is simpler and works with the standard PICK ONE OR MORE.
Testing the Count
To confirm the number of selected records, you can log or display it:
DISPLAY MESSAGE 'Selected count: ' + COUNT(MyObject.SelectedItems)
Add this right after the PICK ONE OR MORE action to debug or inform the user.
Notes
Ensure SelectedItems is a multiple reference attribute in MyObject. If you’re not using a specific attribute, the selected records might be available in the process context (e.g., CurrentObject), depending on how you’ve set it up.
If you’re unsure where the selections are stored, check the process context or the PICK ONE OR MORE configuration in the Aware IM Configuration Tool.
This approach lets you count the selections and enforce your limit without needing to modify the UI directly. Let me know if you need help refining this further!