Action to get a GlideAggregate count for a field #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull Request (PR) addresses an enhancement related to one of the issues in the Action Pack repository:
Issue: feat: Create an action to get a GlideAggregate count for a field #5
The PR introduces an improved version of the Flow Action by adding a new input parameter to accept a column name. In the Script step, validation logic has been implemented to check whether the provided column name is valid. If the column name is invalid, the script triggers Error Evaluation with appropriate error messages and error codes.
If the user provides a valid column name, the script executes successfully and returns an array of objects as output. Each object contains the column value and its corresponding count.
Additionally, a try-catch block has been added to handle any unexpected errors during script execution. Errors caught in the catch block are also handled via Error Evaluation, ensuring robust error reporting and flow control.
The functionality was tested using a background script, verifying both valid and invalid input scenarios.
Input:
var inputs = {};
inputs.table = 'incident';
inputs.condition = 'active=true';
inputs.column_to_group_by = 'assignment_group';
var outputs = sn_fd.FlowAPI.executeActionQuick('Get_GlideAggregate_Count', inputs);
gs.info(JSON.stringify(outputs));
Output:
{"result":[{"count":"25","columnValue":""},{"count":"3","columnValue":"8a5055c9c61122780043563ef53438e3"},{"count":"3","columnValue":"287ebd7da9fe198100f92cc8d1d2154e"},{"count":"1","columnValue":"36c741fa731313005754660c4cf6a70d"},{"count":"5","columnValue":"d625dccec0a8016700a222a0f7900d06"},{"count":"6","columnValue":"8a4dde73c6112278017a6a4baf547aa7"}],"dont_treat_as_error":true,"action_status":{"code":0,"message":"Success"}}