diff --git a/b812ceb69337a210633378917cba10bc/update/sys_hub_action_type_definition_fc0cf4b153907610db6151a0a0490e2d.xml b/b812ceb69337a210633378917cba10bc/update/sys_hub_action_type_definition_fc0cf4b153907610db6151a0a0490e2d.xml index 5bb096a..834a69c 100644 --- a/b812ceb69337a210633378917cba10bc/update/sys_hub_action_type_definition_fc0cf4b153907610db6151a0a0490e2d.xml +++ b/b812ceb69337a210633378917cba10bc/update/sys_hub_action_type_definition_fc0cf4b153907610db6151a0a0490e2d.xml @@ -16,7 +16,7 @@ false get_glideaggregate_count - [{"name":"{{action.table}}","label":"action➛Table","type":"action","ref":"","reference_display":"","base_type":"table_name","parent_table_name":"","column_name":"","choices":null,"attributes":{}},{"name":"{{action.condition}}","label":"action➛Condition","type":"action","ref":"","reference_display":"","base_type":"conditions","parent_table_name":"","column_name":"","choices":null,"attributes":{}},{"name":"{{step[67e628fc-09b1-48a4-a4ff-f903457f698a].count}}","label":"step➛Script step➛count","type":"step","ref":"","reference_display":"","base_type":"integer","parent_table_name":"","column_name":"","choices":null,"attributes":{"sourceId":"","sourceUiUniqueId":"","sourceType":""}}] + [{"name":"{{action.table}}","label":"action➛Table","type":"action","ref":"","reference_display":"","base_type":"table_name","parent_table_name":"","column_name":"","choices":null,"attributes":{}},{"name":"{{action.condition}}","label":"action➛Condition","type":"action","ref":"","reference_display":"","base_type":"conditions","parent_table_name":"","column_name":"","choices":null,"attributes":{}},{"name":"{{action.column_to_group_by}}","label":"action➛Column name to group by","type":"action","ref":"","reference_display":"","base_type":"string","parent_table_name":"","column_name":"","choices":null,"attributes":{"sourceId":"","uiTypeLabel":"String","element_mapping_provider":"com.glide.flow_design.action.data.FlowDesignVariableMapper","sourceUiUniqueId":"","sourceType":"","uiType":"string","uiUniqueId":"62cc8b31-21b6-49b7-9a0c-3f592b7d829e"}},{"name":"{{step[67e628fc-09b1-48a4-a4ff-f903457f698a].result}}","label":"step➛Script step➛result","type":"step","ref":"","reference_display":"","base_type":"array.string","parent_table_name":"","column_name":"","choices":null,"attributes":{"sourceId":"","child_name":"result_child0","uiUniqueId":"4a11cd9c-69bb-4693-8007-b6f6367c02a6","uiTypeLabel":"Object","co_type_name":"FD764afd1eac1cf2104c241d9229212d46","child_label":"result_child0","child_type_label":"String","element_mapping_provider":"com.glide.flow_design.action.data.FlowDesignVariableMapper","sourceUiUniqueId":"","sourceType":"","uiType":"object","child_type":"string","child_uiUniqueId":"6a139844-ee74-43f3-9dc2-d27a966339b4"}},{"name":"{{step[67e628fc-09b1-48a4-a4ff-f903457f698a].__step_status__.message}}","label":"step➛Script step➛Step Status➛Message","type":"step","ref":"","reference_display":"","base_type":"string","parent_table_name":"","column_name":"","choices":null,"attributes":{}},{"name":"{{step[67e628fc-09b1-48a4-a4ff-f903457f698a].__step_status__.code}}","label":"step➛Script step➛Step Status➛Code","type":"step","ref":"","reference_display":"","base_type":"integer","parent_table_name":"","column_name":"","choices":null,"attributes":{}}] fe8cf4f153907610db6151a0a0490e43 Get GlideAggregate Count @@ -31,7 +31,7 @@ global / fc0cf4b153907610db6151a0a0490e2d - 5 + 164 Get GlideAggregate Count b812ceb69337a210633378917cba10bc @@ -39,7 +39,7 @@ b812ceb69337a210633378917cba10bc sys_hub_action_type_definition_fc0cf4b153907610db6151a0a0490e2d admin - 2025-09-30 18:10:44 + 2025-10-02 13:27:57 false @@ -53,26 +53,12 @@ admin 2025-09-30 18:10:16 587cf0f153907610db6151a0a0490eef - 0 + 2 admin - 2025-09-30 18:10:16 - {"version":"1.0","complexObject":{"code":{"$cv":{"$c":"java.lang.String","$v":""}},"message":{"$cv":{"$c":"java.lang.String","$v":""}}},"complexObjectSchema":{"FlowDesigner:FDACTIONSTATUS":{"code":"Integer","code.$field_facets":{"SimpleMapFacet":"{\"uiTypeLabel\":\"Integer\",\"read_only\":\"false\",\"hint\":\"\",\"uiType\":\"integer\",\"default_value\":\"\",\"label\":\"Code\",\"action_error_output\":\"true\",\"mandatory\":\"false\",\"order\":\"1\",\"max_length\":\"40\"}"},"message":"String","message.$field_facets":{"SimpleMapFacet":"{\"uiTypeLabel\":\"String\",\"read_only\":\"false\",\"hint\":\"\",\"uiType\":\"string\",\"default_value\":\"\",\"label\":\"Message\",\"action_error_output\":\"true\",\"mandatory\":\"false\",\"order\":\"2\",\"max_length\":\"4000\"}"}},"FlowDesigner:FDACTIONSTATUS.$type_facets":{"SimpleMapFacet":"{\"default_value\":\"\",\"label\":\"Action Status\",\"action_error_output\":\"true\",\"mandatory\":\"false\",\"uiUniqueId\":\"4adfb7bc-9d67-498d-88d0-8d6c3d584fed\",\"uiTypeLabel\":\"Object\",\"co_type_name\":\"FDACTIONSTATUS\",\"element_mapping_provider\":\"com.glide.flow_design.action.data.FlowDesignVariableMapper\",\"read_only\":\"false\",\"hint\":null,\"uiType\":\"object\",\"order\":\"1\",\"max_length\":\"65000\"}"}},"serializationFormat":"JSON"} + 2025-10-02 13:01:18 + {"version":"1.0","complexObjectSchema":{"FlowDesigner:FDACTIONSTATUS":{"code":"Integer","code.$field_facets":{"SimpleMapFacet":"{\"uiTypeLabel\":\"Integer\",\"read_only\":\"false\",\"hint\":\"\",\"uiType\":\"integer\",\"default_value\":\"\",\"label\":\"Code\",\"action_error_output\":\"true\",\"mandatory\":\"false\",\"order\":\"1\",\"max_length\":\"40\"}"},"message":"String","message.$field_facets":{"SimpleMapFacet":"{\"uiTypeLabel\":\"String\",\"read_only\":\"false\",\"hint\":\"\",\"uiType\":\"string\",\"mapped\":\"{}\",\"default_value\":\"\",\"label\":\"Message\",\"action_error_output\":\"true\",\"mandatory\":\"false\",\"order\":\"2\",\"max_length\":\"4000\"}"}},"FlowDesigner:FDACTIONSTATUS.$type_facets":{"SimpleMapFacet":"{\"default_value\":\"\",\"label\":\"Action Status\",\"action_error_output\":\"true\",\"mandatory\":\"false\",\"uiUniqueId\":\"4adfb7bc-9d67-498d-88d0-8d6c3d584fed\",\"uiTypeLabel\":\"Object\",\"co_type_name\":\"FDACTIONSTATUS\",\"element_mapping_provider\":\"com.glide.flow_design.action.data.FlowDesignVariableMapper\",\"read_only\":\"false\",\"hint\":null,\"uiType\":\"object\",\"order\":\"1\",\"max_length\":\"65000\"}"}},"serializationFormat":"JSON","complexObject":{"code":{"$cv":{"$c":"java.lang.String","$v":""}},"message":{"$cv":{"$c":"java.lang.String","$v":""}}}} 0c7cf0f153907610db6151a0a0490ec3 - - sys_hub_action_type_definition - fc0cf4b153907610db6151a0a0490e2d - 2 - sys_variable_value - admin - 2025-09-30 18:10:16 - 947cf0f153907610db6151a0a0490eef - 0 - admin - 2025-09-30 18:10:16 - - c47cf0f153907610db6151a0a0490ec8 - sys_hub_action_type_definition fc0cf4b153907610db6151a0a0490e2d @@ -94,12 +80,24 @@ admin 2025-09-30 18:10:16 d87cf0f153907610db6151a0a0490eee - 0 + 2 admin - 2025-09-30 18:10:16 + 2025-10-02 09:06:25 var__m_sys_hub_action_output_fc0cf4b153907610db6151a0a0490e2d
{{step[67e628fc-09b1-48a4-a4ff-f903457f698a].count}} + + result + fc0cf4b153907610db6151a0a0490e2d + admin + 2025-10-02 09:08:36 + c1a31196c358f2104e08bd43e4013109 + 4 + admin + 2025-10-02 09:20:12 + var__m_sys_hub_action_output_fc0cf4b153907610db6151a0a0490e2d
+ {{step[67e628fc-09b1-48a4-a4ff-f903457f698a].result}} +
__action_status__ fc0cf4b153907610db6151a0a0490e2d @@ -142,10 +140,10 @@ admin 2025-09-30 18:10:15 087cf0f153907610db6151a0a0490e39 - 1 + 41 b812ceb69337a210633378917cba10bc admin - 2025-09-30 18:10:16 + 2025-10-02 13:27:50 @@ -170,49 +168,69 @@ admin 2025-09-30 18:10:16 887cf0f153907610db6151a0a0490e9a - 0 + 40 admin - 2025-09-30 18:10:16 + 2025-10-02 13:27:50 (function execute(inputs, outputs) { - var countGa = new GlideAggregate(inputs.inputTable); - if (inputs.inputCondition) { - countGa.addEncodedQuery(inputs.inputCondition); - } - countGa.addAggregate("COUNT"); - countGa.query(); - var count = 0; - if (countGa.next()) { - count = countGa.getAggregate("COUNT"); + try { + + //First check whether input column name exist in the table or not. + var gr = new GlideRecord(inputs.inputTable); + + if (!gr.isValidField(inputs.inputFieldName)) { // if input column is not present then throw error + throw new Error("Invalid field name: " + inputs.inputFieldName); + } + // if input column name is present then GlideAggregate and find the column value and count + var countGa = new GlideAggregate(inputs.inputTable); + if (inputs.inputCondition) { + countGa.addEncodedQuery(inputs.inputCondition); + } + + countGa.groupBy(inputs.inputFieldName); + countGa.addAggregate("COUNT"); + countGa.query(); + + var results = []; // to store the column value and count + while (countGa.next()) { + var a = {}; + a.columnValue = countGa.getValue(inputs.inputFieldName); + a.count = countGa.getAggregate('COUNT'); + results.push(a); + } + + outputs.result = results; + + } catch (error) { + // Re-throw the error in case of any other errors + throw new Error("Flow Action Error: " + error.message); } - outputs.count = parseInt(count, 10) || 0; -})(inputs, outputs); - +})(inputs, outputs); 71aa7f6647032200b4fad7527c9a719b - application + inputCondition 087cf0f153907610db6151a0a0490e39 admin 2025-09-30 18:10:16 - 087cf0f153907610db6151a0a0490e99 + 447cf0f153907610db6151a0a0490e9b 0 admin 2025-09-30 18:10:16 - var__m_sys_flow_step_definition_input_106afb6647032200b4fad7527c9a71e7
- + var__m_sys_hub_step_ext_input_087cf0f153907610db6151a0a0490e39
+ {{action.condition}}
- inputCondition + inputFieldName 087cf0f153907610db6151a0a0490e39 admin - 2025-09-30 18:10:16 - 447cf0f153907610db6151a0a0490e9b + 2025-10-02 08:54:17 + 93509912c358f2104e08bd43e4013180 0 admin - 2025-09-30 18:10:16 + 2025-10-02 08:54:17 var__m_sys_hub_step_ext_input_087cf0f153907610db6151a0a0490e39
- {{action.condition}} + {{action.column_to_group_by}}
inputTable @@ -230,18 +248,101 @@ script 087cf0f153907610db6151a0a0490e39 admin - 2025-09-30 18:10:16 - cc7cf0f153907610db6151a0a0490e99 + 2025-10-02 08:54:17 + 1b509912c358f2104e08bd43e401317e 0 admin - 2025-09-30 18:10:16 + 2025-10-02 08:54:17 var__m_sys_flow_step_definition_input_106afb6647032200b4fad7527c9a71e7
- + + + true + false + false + element_mapping_provider=com.glide.flow_design.action.data.FlowDesignVariableMapper,uiType=string,uiTypeLabel=String + false + + + + + + + + + + + + + false + false + + + + inputFieldName + false + + + + false + + + string + true false @@ -408,12 +509,35 @@ false - + + + true false false - element_mapping_provider=com.glide.flow_design.action.data.FlowDesignVariableMapper,uiType=integer,uiTypeLabel=Integer,uiUniqueId=2efed58b-c8a0-4486-abf5-341a02cb6c60 + child_label=result_child0,child_name=result_child0,child_type=string,child_type_label=String,child_uiUniqueId=035dfb71-545f-4db8-a659-c6fcbb5dd907,co_type_name=FDbecaf95e9c1cf2108f9b546fabcc7e09,element_mapping_provider=com.glide.flow_design.action.data.FlowDesignVariableMapper,uiType=array.string,uiTypeLabel=Array.String,uiUniqueId=4a11cd9c-69bb-4693-8007-b6f6367c02a6 false - count + result false @@ -445,10 +569,10 @@ false - integer - + string + true - 40 + 65000 087cf0f153907610db6151a0a0490e39 087cf0f153907610db6151a0a0490e39 sys_hub_step_instance @@ -470,16 +594,16 @@ false sys_hub_step_ext_output admin - 2025-09-30 18:10:15 - c07cf0f153907610db6151a0a0490e8f - 0 + 2025-10-02 09:43:23 + aa9b1192c398f2104e08bd43e40131ad + 7 b812ceb69337a210633378917cba10bc admin - 2025-09-30 18:10:15 + 2025-10-02 11:59:40 false false false @@ -493,18 +617,19 @@ false + - count + result - + en var__m_sys_hub_step_ext_output_087cf0f153907610db6151a0a0490e39 sys_documentation admin - 2025-09-30 18:10:15 - 847cf0f153907610db6151a0a0490e92 + 2025-10-02 09:43:23 + ae9b1192c398f2104e08bd43e40131e2 0 b812ceb69337a210633378917cba10bc @@ -512,11 +637,95 @@ b812ceb69337a210633378917cba10bc admin - 2025-09-30 18:10:15 + 2025-10-02 09:43:23 - + + + true + false + false + element_mapping_provider=com.glide.flow_design.action.data.FlowDesignVariableMapper,uiType=string,uiTypeLabel=String,uiUniqueId=62cc8b31-21b6-49b7-9a0c-3f592b7d829e + false + + + + + + + + + + + + + false + false + + + + column_to_group_by + false + + + + false + + + string + + true + 8000 + fc0cf4b153907610db6151a0a0490e2d + fc0cf4b153907610db6151a0a0490e2d + sys_hub_action_type_definition + var__m_sys_hub_action_input_fc0cf4b153907610db6151a0a0490e2d + + 3 + false + false + + + + false + + + + + + false + false + sys_hub_action_input + admin + 2025-10-02 08:46:57 + 77ae859ec318f2104e08bd43e4013119 + 2 + + + + b812ceb69337a210633378917cba10bc + + admin + 2025-10-02 09:28:58 + false + false + false + false + false + simple + false + script + + + false + + true false @@ -664,14 +873,14 @@ admin 2025-09-30 18:10:15 cc7cf0f153907610db6151a0a0490e32 - 1 + 84 b812ceb69337a210633378917cba10bc admin - 2025-09-30 18:10:43 + 2025-10-02 13:27:56 false false false @@ -685,7 +894,7 @@ false - + true false @@ -733,7 +942,7 @@ sys_hub_action_type_definition var__m_sys_hub_action_output_fc0cf4b153907610db6151a0a0490e2d - 1 + 2 false false @@ -751,14 +960,14 @@ admin 2025-09-30 18:10:16 0c7cf0f153907610db6151a0a0490ec3 - 0 + 1 b812ceb69337a210633378917cba10bc admin - 2025-09-30 18:10:16 + 2025-10-02 09:08:35 false false false @@ -838,14 +1047,14 @@ admin 2025-09-30 18:10:16 407cf0f153907610db6151a0a0490ecc - 3 + 169 b812ceb69337a210633378917cba10bc admin - 2025-09-30 18:10:43 + 2025-10-02 13:27:56 false false false @@ -864,7 +1073,7 @@ true false false - element_mapping_provider=com.glide.flow_design.action.data.FlowDesignVariableMapper,uiType=integer,uiTypeLabel=Integer,uiUniqueId=74a3f09f-b6a1-4b74-a34b-35f5dac6d9a7 + child_label=result_child0,child_name=result_child0,child_type=object,child_type_label=Object,child_uiUniqueId=2acdebc4-545f-4062-a56f-1f7aaf1b3bdd,element_mapping_provider=com.glide.flow_design.action.data.FlowDesignVariableMapper,pwd2droppable=true,uiType=string,uiTypeLabel=String,uiUniqueId=c5101a62-23e6-4447-ad0b-12e11618dfda false - count + result false @@ -898,16 +1107,16 @@ - integer - + string + true - 40 + 8000 fc0cf4b153907610db6151a0a0490e2d fc0cf4b153907610db6151a0a0490e2d sys_hub_action_type_definition var__m_sys_hub_action_output_fc0cf4b153907610db6151a0a0490e2d - 2 + 1 false false @@ -923,16 +1132,16 @@ false sys_hub_action_output admin - 2025-09-30 18:10:16 - c47cf0f153907610db6151a0a0490ec8 - 0 + 2025-10-02 09:43:24 + 729b5192c398f2104e08bd43e4013103 + 6 b812ceb69337a210633378917cba10bc admin - 2025-09-30 18:10:16 + 2025-10-02 11:54:10 false false false @@ -945,8 +1154,8 @@ false - - + + @@ -958,7 +1167,22 @@ admin 2025-09-30 18:10:16 - + + + 507cf0f153907610db6151a0a0490ef1 + {{step[67e628fc-09b1-48a4-a4ff-f903457f698a].__step_status__.message}}LIKEInvalid field name:^NQ{{step[67e628fc-09b1-48a4-a4ff-f903457f698a].__step_status__.message}}LIKEFlow Action Error: + false + + 1 + {"version":"1.0","complexObjectSchema":{"FlowDesigner:FDACTIONSTATUS":{"code":"Integer","code.$field_facets":{"SimpleMapFacet":"{\"uiTypeLabel\":\"Integer\",\"read_only\":\"false\",\"hint\":\"\",\"uiType\":\"integer\",\"default_value\":\"\",\"label\":\"Code\",\"action_error_output\":\"true\",\"mandatory\":\"false\",\"order\":\"1\",\"max_length\":\"40\"}"},"message":"String","message.$field_facets":{"SimpleMapFacet":"{\"uiTypeLabel\":\"String\",\"read_only\":\"false\",\"hint\":\"\",\"uiType\":\"string\",\"mapped\":\"{\\\"message\\\":\\\"{{step[67e628fc-09b1-48a4-a4ff-f903457f698a].__step_status__.message}}\\\"}\",\"default_value\":\"\",\"label\":\"Message\",\"action_error_output\":\"true\",\"mandatory\":\"false\",\"order\":\"2\",\"max_length\":\"4000\"}"}},"FlowDesigner:FDACTIONSTATUS.$type_facets":{"SimpleMapFacet":"{\"default_value\":\"\",\"label\":\"Action Status\",\"action_error_output\":\"true\",\"mandatory\":\"false\",\"uiUniqueId\":\"4adfb7bc-9d67-498d-88d0-8d6c3d584fed\",\"uiTypeLabel\":\"Object\",\"co_type_name\":\"FDACTIONSTATUS\",\"element_mapping_provider\":\"com.glide.flow_design.action.data.FlowDesignVariableMapper\",\"read_only\":\"false\",\"hint\":null,\"uiType\":\"object\",\"order\":\"1\",\"max_length\":\"65000\"}"}},"serializationFormat":"JSON","complexObject":{"code":{"$cv":{"$c":"java.lang.String","$v":"1"}},"message":{"$cv":{"$c":"java.lang.String","$v":""}}}} + admin + 2025-10-02 12:29:13 + 3f8182d6c35cf2104e08bd43e4013153 + 4 + admin + 2025-10-02 13:21:11 + + table @@ -982,6 +1206,29 @@ + + column_to_group_by + + + + en + var__m_sys_hub_action_input_fc0cf4b153907610db6151a0a0490e2d + + sys_documentation + admin + 2025-10-02 08:46:57 + 3bae859ec318f2104e08bd43e401312b + 0 + + b812ceb69337a210633378917cba10bc + + b812ceb69337a210633378917cba10bc + + admin + 2025-10-02 08:46:57 + + + condition @@ -1006,6 +1253,7 @@ + __action_status__ @@ -1030,17 +1278,17 @@ - count + result - + en var__m_sys_hub_action_output_fc0cf4b153907610db6151a0a0490e2d sys_documentation admin - 2025-09-30 18:10:16 - 847cf0f153907610db6151a0a0490ecb + 2025-10-02 09:43:24 + 3a9b5192c398f2104e08bd43e4013107 0 b812ceb69337a210633378917cba10bc @@ -1048,7 +1296,7 @@ b812ceb69337a210633378917cba10bc admin - 2025-09-30 18:10:16 + 2025-10-02 09:43:24 @@ -1080,17 +1328,17 @@ fc0cf4b153907610db6151a0a0490e2d {"type":"PlanProxy","persistor":{"@class":".ChunkingPlanPersistor","table":"sys_hub_action_plan","id":"5f8cf4f153907610db6151a0a0490eae","name":"plan","plan_signature":null}} - 0f8cf4f153907610db6151a0a0490e89 + c00fc29ac39cf2104e08bd43e40131d1 admin 2025-09-30 18:10:45 global / 5f8cf4f153907610db6151a0a0490eae - 0 + 23 admin - 2025-09-30 18:10:45 + 2025-10-02 13:27:58 public @@ -1107,7 +1355,7 @@ Get a count of records using GlideAggregate with an action, letting me provide the table name and query as input. get_glideaggregate_count - [{"name":"{{action.table}}","label":"action➛Table","type":"action","ref":"","reference_display":"","base_type":"table_name","parent_table_name":"","column_name":"","choices":null,"attributes":{}},{"name":"{{action.condition}}","label":"action➛Condition","type":"action","ref":"","reference_display":"","base_type":"conditions","parent_table_name":"","column_name":"","choices":null,"attributes":{}},{"name":"{{step[67e628fc-09b1-48a4-a4ff-f903457f698a].count}}","label":"step➛Script step➛count","type":"step","ref":"","reference_display":"","base_type":"integer","parent_table_name":"","column_name":"","choices":null,"attributes":{"sourceId":"","sourceUiUniqueId":"","sourceType":""}}] + [{"name":"{{action.table}}","label":"action➛Table","type":"action","ref":"","reference_display":"","base_type":"table_name","parent_table_name":"","column_name":"","choices":null,"attributes":{}},{"name":"{{action.condition}}","label":"action➛Condition","type":"action","ref":"","reference_display":"","base_type":"conditions","parent_table_name":"","column_name":"","choices":null,"attributes":{}},{"name":"{{action.column_to_group_by}}","label":"action➛Column name to group by","type":"action","ref":"","reference_display":"","base_type":"string","parent_table_name":"","column_name":"","choices":null,"attributes":{"sourceId":"","uiTypeLabel":"String","element_mapping_provider":"com.glide.flow_design.action.data.FlowDesignVariableMapper","sourceUiUniqueId":"","sourceType":"","uiType":"string","uiUniqueId":"62cc8b31-21b6-49b7-9a0c-3f592b7d829e"}},{"name":"{{step[67e628fc-09b1-48a4-a4ff-f903457f698a].result}}","label":"step➛Script step➛result","type":"step","ref":"","reference_display":"","base_type":"array.string","parent_table_name":"","column_name":"","choices":null,"attributes":{"sourceId":"","child_name":"result_child0","uiUniqueId":"4a11cd9c-69bb-4693-8007-b6f6367c02a6","uiTypeLabel":"Object","co_type_name":"FD764afd1eac1cf2104c241d9229212d46","child_label":"result_child0","child_type_label":"String","element_mapping_provider":"com.glide.flow_design.action.data.FlowDesignVariableMapper","sourceUiUniqueId":"","sourceType":"","uiType":"object","child_type":"string","child_uiUniqueId":"6a139844-ee74-43f3-9dc2-d27a966339b4"}},{"name":"{{step[67e628fc-09b1-48a4-a4ff-f903457f698a].__step_status__.message}}","label":"step➛Script step➛Step Status➛Message","type":"step","ref":"","reference_display":"","base_type":"string","parent_table_name":"","column_name":"","choices":null,"attributes":{}},{"name":"{{step[67e628fc-09b1-48a4-a4ff-f903457f698a].__step_status__.code}}","label":"step➛Script step➛Step Status➛Code","type":"step","ref":"","reference_display":"","base_type":"integer","parent_table_name":"","column_name":"","choices":null,"attributes":{}}] true Get GlideAggregate Count @@ -1120,7 +1368,7 @@ global / fe8cf4f153907610db6151a0a0490e43 - 0 + 9 @@ -1128,7 +1376,7 @@ b812ceb69337a210633378917cba10bc admin - 2025-09-30 18:10:43 + 2025-10-02 12:29:21 false @@ -1142,26 +1390,12 @@ admin 2025-09-30 18:10:44 438cf4f153907610db6151a0a0490e88 - 0 + 2 admin - 2025-09-30 18:10:44 - {"version":"1.0","complexObject":{"code":{"$cv":{"$c":"java.lang.String","$v":""}},"message":{"$cv":{"$c":"java.lang.String","$v":""}}},"complexObjectSchema":{"FlowDesigner:FDACTIONSTATUS":{"code":"Integer","code.$field_facets":{"SimpleMapFacet":"{\"uiTypeLabel\":\"Integer\",\"read_only\":\"false\",\"hint\":\"\",\"uiType\":\"integer\",\"default_value\":\"\",\"label\":\"Code\",\"action_error_output\":\"true\",\"mandatory\":\"false\",\"order\":\"1\",\"max_length\":\"40\"}"},"message":"String","message.$field_facets":{"SimpleMapFacet":"{\"uiTypeLabel\":\"String\",\"read_only\":\"false\",\"hint\":\"\",\"uiType\":\"string\",\"default_value\":\"\",\"label\":\"Message\",\"action_error_output\":\"true\",\"mandatory\":\"false\",\"order\":\"2\",\"max_length\":\"4000\"}"}},"FlowDesigner:FDACTIONSTATUS.$type_facets":{"SimpleMapFacet":"{\"default_value\":\"\",\"label\":\"Action Status\",\"action_error_output\":\"true\",\"mandatory\":\"false\",\"uiUniqueId\":\"4adfb7bc-9d67-498d-88d0-8d6c3d584fed\",\"uiTypeLabel\":\"Object\",\"co_type_name\":\"FDACTIONSTATUS\",\"element_mapping_provider\":\"com.glide.flow_design.action.data.FlowDesignVariableMapper\",\"read_only\":\"false\",\"hint\":null,\"uiType\":\"object\",\"order\":\"1\",\"max_length\":\"65000\"}"}},"serializationFormat":"JSON"} + 2025-10-02 13:01:19 + {"version":"1.0","complexObjectSchema":{"FlowDesigner:FDACTIONSTATUS":{"code":"Integer","code.$field_facets":{"SimpleMapFacet":"{\"uiTypeLabel\":\"Integer\",\"read_only\":\"false\",\"hint\":\"\",\"uiType\":\"integer\",\"default_value\":\"\",\"label\":\"Code\",\"action_error_output\":\"true\",\"mandatory\":\"false\",\"order\":\"1\",\"max_length\":\"40\"}"},"message":"String","message.$field_facets":{"SimpleMapFacet":"{\"uiTypeLabel\":\"String\",\"read_only\":\"false\",\"hint\":\"\",\"uiType\":\"string\",\"mapped\":\"{}\",\"default_value\":\"\",\"label\":\"Message\",\"action_error_output\":\"true\",\"mandatory\":\"false\",\"order\":\"2\",\"max_length\":\"4000\"}"}},"FlowDesigner:FDACTIONSTATUS.$type_facets":{"SimpleMapFacet":"{\"default_value\":\"\",\"label\":\"Action Status\",\"action_error_output\":\"true\",\"mandatory\":\"false\",\"uiUniqueId\":\"4adfb7bc-9d67-498d-88d0-8d6c3d584fed\",\"uiTypeLabel\":\"Object\",\"co_type_name\":\"FDACTIONSTATUS\",\"element_mapping_provider\":\"com.glide.flow_design.action.data.FlowDesignVariableMapper\",\"read_only\":\"false\",\"hint\":null,\"uiType\":\"object\",\"order\":\"1\",\"max_length\":\"65000\"}"}},"serializationFormat":"JSON","complexObject":{"code":{"$cv":{"$c":"java.lang.String","$v":""}},"message":{"$cv":{"$c":"java.lang.String","$v":""}}}} 878cf4f153907610db6151a0a0490e76
- - sys_hub_action_type_snapshot - fe8cf4f153907610db6151a0a0490e43 - 2 - sys_variable_value - admin - 2025-09-30 18:10:44 - 8f8cf4f153907610db6151a0a0490e87 - 0 - admin - 2025-09-30 18:10:44 - - 4b8cf4f153907610db6151a0a0490e7a - sys_hub_action_type_snapshot fe8cf4f153907610db6151a0a0490e43 @@ -1189,6 +1423,18 @@ var__m_sys_hub_action_output_fe8cf4f153907610db6151a0a0490e43
{{step[67e628fc-09b1-48a4-a4ff-f903457f698a].count}}
+ + result + fe8cf4f153907610db6151a0a0490e43 + admin + 2025-10-02 09:58:33 + a81f95d6c398f2104e08bd43e40131cd + 0 + admin + 2025-10-02 09:58:33 + var__m_sys_hub_action_output_fe8cf4f153907610db6151a0a0490e43
+ {{step[67e628fc-09b1-48a4-a4ff-f903457f698a].result}} +
__action_status__ fe8cf4f153907610db6151a0a0490e43 @@ -1231,10 +1477,10 @@ admin 2025-09-30 18:10:43 7e8cf4f153907610db6151a0a0490e5e - 1 + 17 b812ceb69337a210633378917cba10bc admin - 2025-09-30 18:10:44 + 2025-10-02 13:27:57 @@ -1245,23 +1491,43 @@ admin 2025-09-30 18:10:44 8f8cf4f153907610db6151a0a0490e72 - 0 + 16 admin - 2025-09-30 18:10:44 + 2025-10-02 13:27:57 (function execute(inputs, outputs) { - var countGa = new GlideAggregate(inputs.inputTable); - if (inputs.inputCondition) { - countGa.addEncodedQuery(inputs.inputCondition); - } - countGa.addAggregate("COUNT"); - countGa.query(); - var count = 0; - if (countGa.next()) { - count = countGa.getAggregate("COUNT"); + try { + + //First check whether input column name exist in the table or not. + var gr = new GlideRecord(inputs.inputTable); + + if (!gr.isValidField(inputs.inputFieldName)) { // if input column is not present then throw error + throw new Error("Invalid field name: " + inputs.inputFieldName); + } + // if input column name is present then GlideAggregate and find the column value and count + var countGa = new GlideAggregate(inputs.inputTable); + if (inputs.inputCondition) { + countGa.addEncodedQuery(inputs.inputCondition); + } + + countGa.groupBy(inputs.inputFieldName); + countGa.addAggregate("COUNT"); + countGa.query(); + + var results = []; // to store the column value and count + while (countGa.next()) { + var a = {}; + a.columnValue = countGa.getValue(inputs.inputFieldName); + a.count = countGa.getAggregate('COUNT'); + results.push(a); + } + + outputs.result = results; + + } catch (error) { + // Re-throw the error in case of any other errors + throw new Error("Flow Action Error: " + error.message); } - outputs.count = parseInt(count, 10) || 0; -})(inputs, outputs); - +})(inputs, outputs); 71aa7f6647032200b4fad7527c9a719b @@ -1280,28 +1546,28 @@ - application + inputCondition 7e8cf4f153907610db6151a0a0490e5e admin 2025-09-30 18:10:44 - 878cf4f153907610db6151a0a0490e72 + c78cf4f153907610db6151a0a0490e73 0 admin 2025-09-30 18:10:44 - var__m_sys_flow_step_definition_input_106afb6647032200b4fad7527c9a71e7
- + var__m_sys_hub_step_ext_input_7e8cf4f153907610db6151a0a0490e5e
+ {{action.condition}}
- inputCondition + inputFieldName 7e8cf4f153907610db6151a0a0490e5e admin - 2025-09-30 18:10:44 - c78cf4f153907610db6151a0a0490e73 + 2025-10-02 09:58:32 + 1c1f95d6c398f2104e08bd43e401314a 0 admin - 2025-09-30 18:10:44 + 2025-10-02 09:58:32 var__m_sys_hub_step_ext_input_7e8cf4f153907610db6151a0a0490e5e
- {{action.condition}} + {{action.column_to_group_by}}
inputTable @@ -1319,18 +1585,101 @@ script 7e8cf4f153907610db6151a0a0490e5e admin - 2025-09-30 18:10:44 - 4b8cf4f153907610db6151a0a0490e72 + 2025-10-02 09:58:32 + 5c1f95d6c398f2104e08bd43e4013149 0 admin - 2025-09-30 18:10:44 + 2025-10-02 09:58:32 var__m_sys_flow_step_definition_input_106afb6647032200b4fad7527c9a71e7
- + + + true + false + false + element_mapping_provider=com.glide.flow_design.action.data.FlowDesignVariableMapper,uiType=string,uiTypeLabel=String + false + + + + + + + + + + + + + false + false + + + + inputFieldName + false + + + + false + + + string + + true + 8000 + 7e8cf4f153907610db6151a0a0490e5e + 7e8cf4f153907610db6151a0a0490e5e + sys_hub_step_instance + var__m_sys_hub_step_ext_input_7e8cf4f153907610db6151a0a0490e5e + + 200 + false + false + + + + false + + + + + + false + false + sys_hub_step_ext_input + admin + 2025-10-02 09:58:30 + 841f95d6c398f2104e08bd43e4013118 + 0 + + + + b812ceb69337a210633378917cba10bc + + admin + 2025-10-02 09:58:30 + false + false + false + false + false + simple + false + script + + + false + true false @@ -1497,12 +1846,35 @@ false - + + + true false false - element_mapping_provider=com.glide.flow_design.action.data.FlowDesignVariableMapper,uiType=integer,uiTypeLabel=Integer,uiUniqueId=2efed58b-c8a0-4486-abf5-341a02cb6c60 + child_label=result_child0,child_name=result_child0,child_type=string,child_type_label=String,child_uiUniqueId=035dfb71-545f-4db8-a659-c6fcbb5dd907,co_type_name=FDf8da3d5e1f1cf2102b627b17bf6fe4a3,element_mapping_provider=com.glide.flow_design.action.data.FlowDesignVariableMapper,uiType=array.string,uiTypeLabel=Array.String,uiUniqueId=4a11cd9c-69bb-4693-8007-b6f6367c02a6 false - count + result false @@ -1534,10 +1906,10 @@ false - integer - + string + true - 40 + 65000 7e8cf4f153907610db6151a0a0490e5e 7e8cf4f153907610db6151a0a0490e5e sys_hub_step_instance @@ -1559,16 +1931,16 @@ false sys_hub_step_ext_output admin - 2025-09-30 18:10:44 - 4b8cf4f153907610db6151a0a0490e69 - 0 + 2025-10-02 09:58:31 + c81f95d6c398f2104e08bd43e401311d + 7 b812ceb69337a210633378917cba10bc admin - 2025-09-30 18:10:44 + 2025-10-02 11:59:48 false false false @@ -1582,18 +1954,19 @@ false + - count + result - + en var__m_sys_hub_step_ext_output_7e8cf4f153907610db6151a0a0490e5e sys_documentation admin - 2025-09-30 18:10:44 - 478cf4f153907610db6151a0a0490e6c + 2025-10-02 09:58:31 + 481f95d6c398f2104e08bd43e4013121 0 b812ceb69337a210633378917cba10bc @@ -1601,11 +1974,11 @@ b812ceb69337a210633378917cba10bc admin - 2025-09-30 18:10:44 + 2025-10-02 09:58:31 - + true false @@ -1774,12 +2147,96 @@ false - + + true + false + false + element_mapping_provider=com.glide.flow_design.action.data.FlowDesignVariableMapper,uiType=string,uiTypeLabel=String,uiUniqueId=62cc8b31-21b6-49b7-9a0c-3f592b7d829e + false + + + + + + + + + + + + + false + false + + + + column_to_group_by + false + + + + false + + + string + + true + 8000 + fe8cf4f153907610db6151a0a0490e43 + fe8cf4f153907610db6151a0a0490e43 + sys_hub_action_type_snapshot + var__m_sys_hub_action_input_fe8cf4f153907610db6151a0a0490e43 + + 3 + false + false + + + + false + + + + + + false + false + sys_hub_action_input + admin + 2025-10-02 09:58:30 + fb0f95d6c398f2104e08bd43e4013106 + 0 + + + + b812ceb69337a210633378917cba10bc + + admin + 2025-10-02 09:58:30 + false + false + false + false + false + simple + false + script + + + false + + + true false false - element_mapping_provider=com.glide.flow_design.action.data.FlowDesignVariableMapper,uiType=integer,uiTypeLabel=Integer,uiUniqueId=74a3f09f-b6a1-4b74-a34b-35f5dac6d9a7 + child_label=result_child0,child_name=result_child0,child_type=object,child_type_label=Object,child_uiUniqueId=2acdebc4-545f-4062-a56f-1f7aaf1b3bdd,element_mapping_provider=com.glide.flow_design.action.data.FlowDesignVariableMapper,pwd2droppable=true,uiType=string,uiTypeLabel=String,uiUniqueId=c5101a62-23e6-4447-ad0b-12e11618dfda false - count + result false @@ -1813,16 +2270,16 @@ - integer - + string + true - 40 + 8000 fe8cf4f153907610db6151a0a0490e43 fe8cf4f153907610db6151a0a0490e43 sys_hub_action_type_snapshot var__m_sys_hub_action_output_fe8cf4f153907610db6151a0a0490e43 - 2 + 1 false false @@ -1838,16 +2295,16 @@ false sys_hub_action_output admin - 2025-09-30 18:10:44 - 4b8cf4f153907610db6151a0a0490e7a - 0 + 2025-10-02 09:58:32 + 141f95d6c398f2104e08bd43e4013167 + 6 b812ceb69337a210633378917cba10bc admin - 2025-09-30 18:10:44 + 2025-10-02 11:54:19 false false false @@ -1860,8 +2317,8 @@ false - - + + true false @@ -1927,14 +2384,14 @@ admin 2025-09-30 18:10:44 838cf4f153907610db6151a0a0490e7e - 1 + 47 b812ceb69337a210633378917cba10bc admin - 2025-09-30 18:10:44 + 2025-10-02 13:27:57 false false false @@ -1996,7 +2453,7 @@ sys_hub_action_type_snapshot var__m_sys_hub_action_output_fe8cf4f153907610db6151a0a0490e43 - 1 + 2 false false @@ -2014,14 +2471,14 @@ admin 2025-09-30 18:10:44 878cf4f153907610db6151a0a0490e76 - 0 + 1 b812ceb69337a210633378917cba10bc admin - 2025-09-30 18:10:44 + 2025-10-02 09:58:32 false false false @@ -2047,7 +2504,22 @@ admin 2025-09-30 18:10:44 - + + + 4b8cf4f153907610db6151a0a0490e89 + {{step[67e628fc-09b1-48a4-a4ff-f903457f698a].__step_status__.message}}LIKEInvalid field name:^NQ{{step[67e628fc-09b1-48a4-a4ff-f903457f698a].__step_status__.message}}LIKEFlow Action Error: + false + + 1 + {"version":"1.0","complexObjectSchema":{"FlowDesigner:FDACTIONSTATUS":{"code":"Integer","code.$field_facets":{"SimpleMapFacet":"{\"uiTypeLabel\":\"Integer\",\"read_only\":\"false\",\"hint\":\"\",\"uiType\":\"integer\",\"default_value\":\"\",\"label\":\"Code\",\"action_error_output\":\"true\",\"mandatory\":\"false\",\"order\":\"1\",\"max_length\":\"40\"}"},"message":"String","message.$field_facets":{"SimpleMapFacet":"{\"uiTypeLabel\":\"String\",\"read_only\":\"false\",\"hint\":\"\",\"uiType\":\"string\",\"mapped\":\"{\\\"message\\\":\\\"{{step[67e628fc-09b1-48a4-a4ff-f903457f698a].__step_status__.message}}\\\"}\",\"default_value\":\"\",\"label\":\"Message\",\"action_error_output\":\"true\",\"mandatory\":\"false\",\"order\":\"2\",\"max_length\":\"4000\"}"}},"FlowDesigner:FDACTIONSTATUS.$type_facets":{"SimpleMapFacet":"{\"default_value\":\"\",\"label\":\"Action Status\",\"action_error_output\":\"true\",\"mandatory\":\"false\",\"uiUniqueId\":\"4adfb7bc-9d67-498d-88d0-8d6c3d584fed\",\"uiTypeLabel\":\"Object\",\"co_type_name\":\"FDACTIONSTATUS\",\"element_mapping_provider\":\"com.glide.flow_design.action.data.FlowDesignVariableMapper\",\"read_only\":\"false\",\"hint\":null,\"uiType\":\"object\",\"order\":\"1\",\"max_length\":\"65000\"}"}},"serializationFormat":"JSON","complexObject":{"code":{"$cv":{"$c":"java.lang.String","$v":"1"}},"message":{"$cv":{"$c":"java.lang.String","$v":""}}}} + admin + 2025-10-02 13:27:57 + 440fc29ac39cf2104e08bd43e40131d0 + 0 + admin + 2025-10-02 13:27:57 + + condition @@ -2071,6 +2543,29 @@ + + column_to_group_by + + + + en + var__m_sys_hub_action_input_fe8cf4f153907610db6151a0a0490e43 + + sys_documentation + admin + 2025-10-02 09:58:30 + 841f95d6c398f2104e08bd43e401310a + 0 + + b812ceb69337a210633378917cba10bc + + b812ceb69337a210633378917cba10bc + + admin + 2025-10-02 09:58:30 + + + table @@ -2095,6 +2590,7 @@ + __dont_treat_as_error__ @@ -2142,17 +2638,17 @@ - count + result - + en var__m_sys_hub_action_output_fe8cf4f153907610db6151a0a0490e43 sys_documentation admin - 2025-09-30 18:10:44 - c78cf4f153907610db6151a0a0490e7d + 2025-10-02 09:58:32 + e01f95d6c398f2104e08bd43e401316c 0 b812ceb69337a210633378917cba10bc @@ -2160,7 +2656,7 @@ b812ceb69337a210633378917cba10bc admin - 2025-09-30 18:10:44 + 2025-10-02 09:58:32 @@ -2168,6 +2664,6 @@ fc0cf4b153907610db6151a0a0490e2d fe8cf4f153907610db6151a0a0490e43 - glide-zurich-07-01-2025__patch0-07-15-2025_07-23-2025_1759.zip + glide-xanadu-07-02-2024__patch6-01-29-2025_02-11-2025_1128.zip