--- /dev/null
+/*\r
+ * SPDX-FileCopyrightText: 2024 Chris Duncan <chris@flowpex.dev>\r
+ * SPDX-License-Identifier: GPL-3.0-or-later\r
+ */\r
+\r
+global class System_Id_to15 {\r
+\r
+ @InvocableMethod(label='System.Id.to15()' category='Flowpex' iconName='slds:utility:record_lookup' description='Converts an 18-character Id value to a 15-character case-sensitive string.')\r
+\r
+ global static List<Response> System_Id_to15 (List<Request> requests) {\r
+ List<Response> responses = new List<Response>();\r
+ for (Request req : requests) {\r
+ Response res = new Response();\r
+ Id reqId = req.Id;\r
+ res.id = reqId.to15();\r
+ responses.add(res);\r
+ }\r
+ return responses;\r
+ }\r
+\r
+ global class Request {\r
+ @InvocableVariable(label='ID' required='true' description='The 18-character ID value to be converted.')\r
+ global String id;\r
+\r
+ global Request () {}\r
+ global Request (String s) {\r
+ this.id = s;\r
+ }\r
+ }\r
+\r
+ global class Response {\r
+ @InvocableVariable(label='SObject Type' description='The 15-character case-sensitive version of the ID.')\r
+ global String id;\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!--\r
+SPDX-FileCopyrightText: 2024 Chris Duncan <chris@flowpex.dev>\r
+SPDX-License-Identifier: GPL-3.0-or-later\r
+-->\r
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">\r
+ <apiVersion>61.0</apiVersion>\r
+ <status>Active</status>\r
+</ApexClass>\r
--- /dev/null
+/*\r
+ * SPDX-FileCopyrightText: 2024 Chris Duncan <chris@flowpex.dev>\r
+ * SPDX-License-Identifier: GPL-3.0-or-later\r
+ */\r
+\r
+@isTest\r
+private class System_Id_to15_TEST {\r
+\r
+ @isTest\r
+ static void testNoArgs () {\r
+ List<System_Id_to15.Request> req = new List<System_Id_to15.Request>();\r
+\r
+ Test.startTest();\r
+ List<System_Id_to15.Response> res = System_Id_to15.System_Id_to15(req);\r
+ Test.stopTest();\r
+\r
+ Assert.areEqual(0, res.size());\r
+ }\r
+\r
+ @isTest\r
+ static void testManyArgs () {\r
+ List<Account> listAccounts = new List<Account>();\r
+ for (Integer i = 0; i < 5; i++) {\r
+ Account a = new Account(\r
+ Name = 'Test Account ' + i,\r
+ BillingStreet = '123 Main Street',\r
+ BillingCity = 'New York',\r
+ BillingState = 'New York',\r
+ BillingPostalCode = '10001',\r
+ BillingCountry = 'United States'\r
+ );\r
+ listAccounts.add(a);\r
+ }\r
+ insert listAccounts;\r
+\r
+ Test.startTest();\r
+ List<System_Id_to15.Request> listSystem_Id_to15Request = new List<System_Id_to15.Request>();\r
+ for (Account a : listAccounts) {\r
+ listSystem_Id_to15Request.add(new System_Id_to15.Request(a.Id));\r
+ }\r
+ List<System_Id_to15.Response> results = System_Id_to15.System_Id_to15(listSystem_Id_to15Request);\r
+ Test.stopTest();\r
+\r
+ Assert.areEqual(5, results.size());\r
+ for (Integer i = 0; i < results.size(); i++) {\r
+ Assert.areEqual(listAccounts[i].Id, results[i].id);\r
+ }\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!--\r
+SPDX-FileCopyrightText: 2024 Chris Duncan <chris@flowpex.dev>\r
+SPDX-License-Identifier: GPL-3.0-or-later\r
+-->\r
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">\r
+ <apiVersion>61.0</apiVersion>\r
+ <status>Active</status>\r
+</ApexClass>\r