Skip to content

Conversation

@shivamvish160
Copy link
Contributor

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"}}

@github-actions
Copy link

github-actions bot commented Oct 2, 2025

Valid PR for ActionPack

Thank you for your contribution. This PR complies with the CONTRIBUTING.md.
A maintainer will review this shortly. In the meantime, Happy Hacking!

@rohi-v rohi-v self-assigned this Oct 2, 2025
@rohi-v
Copy link
Contributor

rohi-v commented Oct 2, 2025

Looking Good, Thank you for your Contribution

@rohi-v rohi-v merged commit 53d864e into ServiceNowDevProgram:main Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants