From 83eda5f2a08f0fdaf46df776698e219fef82cc81 Mon Sep 17 00:00:00 2001 From: Eric Smith Date: Tue, 13 Aug 2024 12:12:40 -0400 Subject: [PATCH 1/2] forceignore --- .forceignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.forceignore b/.forceignore index 29af63a93..af674fe91 100644 --- a/.forceignore +++ b/.forceignore @@ -1,3 +1,7 @@ **/jsconfig.json **/.eslintrc.json + +**/tsconfig.json + +**/*.ts From c0ac868a4fcea244bf7d1ee410eeebe1be88f25e Mon Sep 17 00:00:00 2001 From: Eric Smith Date: Tue, 13 Aug 2024 13:37:19 -0400 Subject: [PATCH 2/2] Reverse Last Commit --- .../CollectionProcessors/.forceignore | 4 ++ .../default/classes/CountRecordsAndFields.cls | 18 ++----- .../main/default/classes/ListActionsTest.cls | 53 ++++++------------- 3 files changed, 25 insertions(+), 50 deletions(-) diff --git a/flow_action_components/CollectionProcessors/.forceignore b/flow_action_components/CollectionProcessors/.forceignore index 84cc8e5b2..e5d970c59 100644 --- a/flow_action_components/CollectionProcessors/.forceignore +++ b/flow_action_components/CollectionProcessors/.forceignore @@ -6,3 +6,7 @@ force-app/main/default/flows/Create_Accounts.flow-meta.xml /force-app/main/default/profiles/ /force-app/main/default/settings/ /force-app/main/default/appMenus/ + +**/tsconfig.json + +**/*.ts diff --git a/flow_action_components/CollectionProcessors/force-app/main/default/classes/CountRecordsAndFields.cls b/flow_action_components/CollectionProcessors/force-app/main/default/classes/CountRecordsAndFields.cls index 4ae228de1..9bc040090 100755 --- a/flow_action_components/CollectionProcessors/force-app/main/default/classes/CountRecordsAndFields.cls +++ b/flow_action_components/CollectionProcessors/force-app/main/default/classes/CountRecordsAndFields.cls @@ -6,22 +6,14 @@ global with sharing class CountRecordsAndFields { List records = curRequest.inputCollection; String fieldName = curRequest.fieldName; String fieldValue = curRequest.fieldValue; - + //Create a Results object to hold the return values Results response = new Results(); try { for (SObject record : records) { if (!String.isBlank(fieldName) && !String.isBlank(fieldValue)) { - // Retrieve the field value from the record - Object fieldVal = record.get(fieldName); - if (fieldVal != null) { - // Convert the field value to a string for comparison - // Handle boolean fields by converting them to strings - String fieldValStr = (fieldVal instanceof Boolean) ? String.valueOf(fieldVal) : fieldVal.toString(); - // Compare the field value string with the provided field value string - if (fieldValStr == fieldValue) { - response.matchedNumber++; - } + if (record.get(fieldName) == fieldValue) { + response.matchedNumber++; } } @@ -30,12 +22,12 @@ global with sharing class CountRecordsAndFields { } catch (Exception ex) { response.errors = ex.getMessage(); } - + //Wrap the Results object in a List container (an extra step added to allow this interface to also support bulkification) responseWrapper.add(response); } - + return responseWrapper; } diff --git a/flow_action_components/CollectionProcessors/force-app/main/default/classes/ListActionsTest.cls b/flow_action_components/CollectionProcessors/force-app/main/default/classes/ListActionsTest.cls index f1ce1c597..5896a8009 100644 --- a/flow_action_components/CollectionProcessors/force-app/main/default/classes/ListActionsTest.cls +++ b/flow_action_components/CollectionProcessors/force-app/main/default/classes/ListActionsTest.cls @@ -13,37 +13,29 @@ public with sharing class ListActionsTest { static void makeData() { Test.startTest(); List testAccounts = new List(); - List testContacts = new List(); // Added to create contacts - - Boolean doNotCallFlag = true; // Initialize the flag for (Integer i = 0; i < NUMBER_OF_TEST_RECORDS; i++) { - Account acc = new Account( - Name = TEST_RECORD_NAME + i, - Website = '' + i, - AnnualRevenue = 5000 - ); - testAccounts.add(acc); - - // Create contacts with DoNotCall field set for boolean testing - Contact con = new Contact( - LastName = TEST_CONTACT_NAME + i, - AccountId = acc.Id, - DoNotCall = doNotCallFlag // Set the value based on the flag + testAccounts.add( + new Account( + Name = TEST_RECORD_NAME + i, + Website = '' + i, + AnnualRevenue = 5000 + ) ); - testContacts.add(con); - - // Toggle the flag - doNotCallFlag = !doNotCallFlag; } - // Insert testAccounts without triggering duplicate rules Database.DMLOptions dml = new Database.DMLOptions(); dml.DuplicateRuleHeader.AllowSave = true; Database.insert(testAccounts, dml); - insert testContacts; // Insert the test contacts + List testContacts = new List(); List testTasks = new List(); for (Integer i = 0; i < testAccounts.size(); i++) { + testContacts.add( + new Contact( + LastName = TEST_CONTACT_NAME + i, + AccountId = testAccounts[i].Id + ) + ); testTasks.add( new Task( Subject = TEST_RECORD_NAME + i, @@ -51,6 +43,7 @@ public with sharing class ListActionsTest { ) ); } + insert testContacts; insert testTasks; Test.stopTest(); } @@ -589,20 +582,6 @@ public with sharing class ListActionsTest { Assert.areEqual(responseWrapper.size(), 1); Assert.areEqual(1, responseWrapper[0].matchedNumber); Assert.areEqual(NUMBER_OF_TEST_RECORDS, responseWrapper[0].totalNumber); - - // Clear the requests list for the next test - requests.clear(); - - // Test counting by boolean field 'DoNotCall' - request.inputCollection = getContacts(NUMBER_OF_TEST_RECORDS); - request.fieldName = 'DoNotCall'; - request.fieldValue = 'true'; - requests.add(request); - - responseWrapper = CountRecordsAndFields.count(requests); - Assert.areEqual(responseWrapper.size(), 1); - Assert.areEqual(3, responseWrapper[0].matchedNumber); // Three records should match (even indices) - Assert.areEqual(NUMBER_OF_TEST_RECORDS, responseWrapper[0].totalNumber); } //this is incompatible with recent work done on this class. however, there's a new set of test classes in a separate file, so just going to comment this one out @@ -764,10 +743,10 @@ public with sharing class ListActionsTest { private static List getContacts(Integer numberOfRecords) { return [ - SELECT Id, LastName, AccountId, DoNotCall + SELECT Id, LastName, AccountId FROM Contact ORDER BY LastName LIMIT :numberOfRecords ]; } -} +} \ No newline at end of file