@salesforce/afv-skills 1.5.1 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -416
- package/package.json +5 -3
- package/skills/building-ui-bundle-app/SKILL.md +325 -0
- package/skills/building-ui-bundle-frontend/SKILL.md +122 -0
- package/skills/{building-webapp-react-components → building-ui-bundle-frontend}/implementation/component.md +1 -1
- package/skills/creating-b2b-commerce-store/SKILL.md +169 -0
- package/skills/creating-b2b-commerce-store/references/store-vs-storefront.md +169 -0
- package/skills/deploying-ui-bundle/SKILL.md +77 -0
- package/skills/generating-apex/CREDITS.md +30 -0
- package/skills/generating-apex/SKILL.md +342 -189
- package/skills/generating-apex/assets/abstract.cls +12 -9
- package/skills/generating-apex/assets/batch.cls +7 -8
- package/skills/generating-apex/assets/domain.cls +5 -6
- package/skills/generating-apex/assets/dto.cls +11 -12
- package/skills/generating-apex/assets/exception.cls +1 -2
- package/skills/generating-apex/assets/interface.cls +2 -3
- package/skills/generating-apex/assets/invocable.cls +114 -0
- package/skills/generating-apex/assets/queueable.cls +6 -7
- package/skills/generating-apex/assets/rest-resource.cls +300 -0
- package/skills/generating-apex/assets/schedulable.cls +7 -8
- package/skills/generating-apex/assets/selector.cls +7 -8
- package/skills/generating-apex/assets/service.cls +4 -5
- package/skills/generating-apex/assets/trigger.cls +45 -0
- package/skills/generating-apex/assets/utility.cls +5 -6
- package/skills/generating-apex/references/AccountDeduplicationBatch.cls +7 -8
- package/skills/generating-apex/references/AccountSelector.cls +10 -11
- package/skills/generating-apex/references/AccountService.cls +9 -10
- package/skills/generating-apex-test/CREDITS.md +30 -0
- package/skills/generating-apex-test/SKILL.md +165 -74
- package/skills/generating-apex-test/assets/test-class-template.cls +25 -56
- package/skills/generating-apex-test/assets/test-data-factory-template.cls +0 -1
- package/skills/generating-apex-test/references/assertion-patterns.md +38 -95
- package/skills/generating-apex-test/references/async-testing.md +59 -142
- package/skills/generating-apex-test/references/mocking-patterns.md +77 -76
- package/skills/generating-apex-test/references/test-data-factory.md +29 -130
- package/skills/generating-experience-react-site/SKILL.md +9 -9
- package/skills/generating-experience-react-site/docs/configure-metadata-digital-experience.md +1 -1
- package/skills/generating-flexipage/SKILL.md +28 -12
- package/skills/generating-ui-bundle-features/SKILL.md +45 -0
- package/skills/generating-ui-bundle-metadata/SKILL.md +106 -0
- package/skills/{managing-webapp-agentforce-conversation-client → implementing-ui-bundle-agentforce-conversation-client}/SKILL.md +5 -5
- package/skills/{managing-webapp-agentforce-conversation-client → implementing-ui-bundle-agentforce-conversation-client}/references/constraints.md +2 -2
- package/skills/{managing-webapp-agentforce-conversation-client → implementing-ui-bundle-agentforce-conversation-client}/references/examples.md +1 -1
- package/skills/{implementing-webapp-file-upload → implementing-ui-bundle-file-upload}/SKILL.md +11 -11
- package/skills/searching-media/SKILL.md +1 -1
- package/skills/uplifting-components-to-slds2/SKILL.md +236 -0
- package/skills/uplifting-components-to-slds2/references/color-hooks-decision-guide.md +438 -0
- package/skills/uplifting-components-to-slds2/references/common-patterns.md +87 -0
- package/skills/uplifting-components-to-slds2/references/examples.md +443 -0
- package/skills/uplifting-components-to-slds2/references/migration-checklist.md +67 -0
- package/skills/uplifting-components-to-slds2/references/non-color-hooks-decision-guide.md +333 -0
- package/skills/uplifting-components-to-slds2/references/rule-lwc-token-to-slds-hook.md +135 -0
- package/skills/uplifting-components-to-slds2/references/rule-no-deprecated-tokens-slds1.md +211 -0
- package/skills/uplifting-components-to-slds2/references/rule-no-hardcoded-values.md +160 -0
- package/skills/uplifting-components-to-slds2/references/rule-no-slds-class-overrides.md +126 -0
- package/skills/{using-webapp-salesforce-data → using-ui-bundle-salesforce-data}/SKILL.md +52 -25
- package/skills/using-ui-bundle-salesforce-data/references/mutation-query-generation.md +140 -0
- package/skills/using-ui-bundle-salesforce-data/references/query-testing.md +78 -0
- package/skills/using-ui-bundle-salesforce-data/references/read-query-generation.md +307 -0
- package/skills/using-ui-bundle-salesforce-data/references/schema-introspection.md +53 -0
- package/skills/using-ui-bundle-salesforce-data/references/ui-bundle-integration.md +221 -0
- package/skills/{using-webapp-salesforce-data → using-ui-bundle-salesforce-data/scripts}/graphql-search.sh +75 -23
- package/skills/building-webapp-data-visualization/SKILL.md +0 -72
- package/skills/building-webapp-data-visualization/implementation/bar-line-chart.md +0 -316
- package/skills/building-webapp-data-visualization/implementation/dashboard-layout.md +0 -189
- package/skills/building-webapp-data-visualization/implementation/donut-chart.md +0 -181
- package/skills/building-webapp-data-visualization/implementation/stat-card.md +0 -150
- package/skills/building-webapp-react-components/SKILL.md +0 -96
- package/skills/configuring-webapp-csp-trusted-sites/SKILL.md +0 -90
- package/skills/configuring-webapp-metadata/SKILL.md +0 -158
- package/skills/creating-webapp/SKILL.md +0 -138
- package/skills/deploying-webapp-to-salesforce/SKILL.md +0 -226
- package/skills/installing-webapp-features/SKILL.md +0 -210
- /package/skills/{building-webapp-react-components → building-ui-bundle-frontend}/implementation/header-footer.md +0 -0
- /package/skills/{building-webapp-react-components → building-ui-bundle-frontend}/implementation/page.md +0 -0
- /package/skills/{configuring-webapp-csp-trusted-sites/implementation/metadata-format.md → generating-ui-bundle-metadata/implementation/csp-metadata-format.md} +0 -0
- /package/skills/{managing-webapp-agentforce-conversation-client → implementing-ui-bundle-agentforce-conversation-client}/references/style-tokens.md +0 -0
- /package/skills/{managing-webapp-agentforce-conversation-client → implementing-ui-bundle-agentforce-conversation-client}/references/troubleshooting.md +0 -0
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
+
<<<<<<< Updated upstream
|
|
2
3
|
* @description Abstract base class for {describe the family of classes this serves}.
|
|
4
|
+
=======
|
|
5
|
+
* Abstract base class for {describe the family of classes this serves}.
|
|
6
|
+
>>>>>>> Stashed changes
|
|
3
7
|
* Provides common behavior and defines extension points for subclasses.
|
|
4
8
|
* Subclasses must implement the abstract methods to provide specific behavior.
|
|
5
|
-
* @author Generated by Apex Class Writer Skill
|
|
6
9
|
*
|
|
7
10
|
* @example
|
|
8
11
|
* // Extending this abstract class:
|
|
@@ -29,7 +32,7 @@ public abstract with sharing class {ClassName} {
|
|
|
29
32
|
// ─── Constructor ─────────────────────────────────────────────────────
|
|
30
33
|
|
|
31
34
|
/**
|
|
32
|
-
*
|
|
35
|
+
* Initializes the base class with default configuration
|
|
33
36
|
*/
|
|
34
37
|
protected {ClassName}() {
|
|
35
38
|
this.timeoutMs = DEFAULT_TIMEOUT_MS;
|
|
@@ -38,14 +41,14 @@ public abstract with sharing class {ClassName} {
|
|
|
38
41
|
// ─── Abstract Methods (must be implemented by subclasses) ────────────
|
|
39
42
|
|
|
40
43
|
/**
|
|
41
|
-
*
|
|
44
|
+
* Returns the endpoint URL for this integration.
|
|
42
45
|
* Subclasses must provide their specific endpoint.
|
|
43
46
|
* @return The endpoint URL as a String
|
|
44
47
|
*/
|
|
45
48
|
protected abstract String getEndpoint();
|
|
46
49
|
|
|
47
50
|
/**
|
|
48
|
-
*
|
|
51
|
+
* Returns the HTTP headers for this integration.
|
|
49
52
|
* Subclasses define their own required headers.
|
|
50
53
|
* @return Map of header name to header value
|
|
51
54
|
*/
|
|
@@ -54,7 +57,7 @@ public abstract with sharing class {ClassName} {
|
|
|
54
57
|
// ─── Virtual Methods (can be overridden by subclasses) ───────────────
|
|
55
58
|
|
|
56
59
|
/**
|
|
57
|
-
*
|
|
60
|
+
* Hook called before the main operation executes.
|
|
58
61
|
* Override to add pre-processing logic.
|
|
59
62
|
* Default implementation does nothing.
|
|
60
63
|
* @param context Map of contextual data
|
|
@@ -64,7 +67,7 @@ public abstract with sharing class {ClassName} {
|
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
/**
|
|
67
|
-
*
|
|
70
|
+
* Hook called after the main operation completes.
|
|
68
71
|
* Override to add post-processing logic.
|
|
69
72
|
* Default implementation does nothing.
|
|
70
73
|
* @param context Map of contextual data
|
|
@@ -77,7 +80,7 @@ public abstract with sharing class {ClassName} {
|
|
|
77
80
|
// ─── Template Method (common workflow) ───────────────────────────────
|
|
78
81
|
|
|
79
82
|
/**
|
|
80
|
-
*
|
|
83
|
+
* Executes the operation using the template method pattern.
|
|
81
84
|
* Calls beforeExecute → doExecute → afterExecute in sequence.
|
|
82
85
|
* @param context Map of data needed for the operation
|
|
83
86
|
* @return The result of the operation
|
|
@@ -100,7 +103,7 @@ public abstract with sharing class {ClassName} {
|
|
|
100
103
|
// ─── Protected Helpers ───────────────────────────────────────────────
|
|
101
104
|
|
|
102
105
|
/**
|
|
103
|
-
*
|
|
106
|
+
* Core execution logic — override this for the main operation.
|
|
104
107
|
* Default implementation throws — subclass must provide implementation.
|
|
105
108
|
* @param context Map of data needed for the operation
|
|
106
109
|
* @return The result of the operation
|
|
@@ -112,7 +115,7 @@ public abstract with sharing class {ClassName} {
|
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
/**
|
|
115
|
-
*
|
|
118
|
+
* Error handler called when doExecute throws.
|
|
116
119
|
* Override to customize error handling (e.g., logging, retry).
|
|
117
120
|
* @param e The exception that was thrown
|
|
118
121
|
*/
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Batch Apex class for {describe the batch operation}.
|
|
3
3
|
* Processes {SObject} records in configurable batch sizes.
|
|
4
4
|
* Implements Database.Stateful to track cumulative results across chunks.
|
|
5
|
-
* @author Generated by Apex Class Writer Skill
|
|
6
5
|
*
|
|
7
6
|
* @example
|
|
8
7
|
* // Execute with default batch size
|
|
@@ -24,7 +23,7 @@ public with sharing class {ClassName} implements Database.Batchable<SObject>, Da
|
|
|
24
23
|
// ─── Constructor ─────────────────────────────────────────────────────
|
|
25
24
|
|
|
26
25
|
/**
|
|
27
|
-
*
|
|
26
|
+
* Default constructor
|
|
28
27
|
*/
|
|
29
28
|
public {ClassName}() {
|
|
30
29
|
// Default configuration
|
|
@@ -33,7 +32,7 @@ public with sharing class {ClassName} implements Database.Batchable<SObject>, Da
|
|
|
33
32
|
// ─── Batchable Interface ─────────────────────────────────────────────
|
|
34
33
|
|
|
35
34
|
/**
|
|
36
|
-
*
|
|
35
|
+
* Defines the scope of records to process.
|
|
37
36
|
* Uses Database.QueryLocator for efficient large-dataset processing.
|
|
38
37
|
* @param bc The batch context
|
|
39
38
|
* @return QueryLocator for the records to process
|
|
@@ -48,7 +47,7 @@ public with sharing class {ClassName} implements Database.Batchable<SObject>, Da
|
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
/**
|
|
51
|
-
*
|
|
50
|
+
* Processes each batch of records.
|
|
52
51
|
* Uses Database.update with allOrNone=false for partial success handling.
|
|
53
52
|
* @param bc The batch context
|
|
54
53
|
* @param scope List of {SObject} records in the current batch
|
|
@@ -68,7 +67,7 @@ public with sharing class {ClassName} implements Database.Batchable<SObject>, Da
|
|
|
68
67
|
}
|
|
69
68
|
|
|
70
69
|
/**
|
|
71
|
-
*
|
|
70
|
+
* Performs post-processing after all batches complete.
|
|
72
71
|
* Logs a summary of the batch execution.
|
|
73
72
|
* @param bc The batch context
|
|
74
73
|
*/
|
|
@@ -94,7 +93,7 @@ public with sharing class {ClassName} implements Database.Batchable<SObject>, Da
|
|
|
94
93
|
// ─── Private Helpers ─────────────────────────────────────────────────
|
|
95
94
|
|
|
96
95
|
/**
|
|
97
|
-
*
|
|
96
|
+
* Processes Database.SaveResult list, tracking successes and failures
|
|
98
97
|
* @param results List of SaveResult from a DML operation
|
|
99
98
|
*/
|
|
100
99
|
private void processResults(List<Database.SaveResult> results) {
|
|
@@ -116,7 +115,7 @@ public with sharing class {ClassName} implements Database.Batchable<SObject>, Da
|
|
|
116
115
|
// ─── Static Helpers ──────────────────────────────────────────────────
|
|
117
116
|
|
|
118
117
|
/**
|
|
119
|
-
*
|
|
118
|
+
* Convenience method to execute with default batch size
|
|
120
119
|
* @return The batch job Id
|
|
121
120
|
*/
|
|
122
121
|
public static Id run() {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Domain class for {SObject}.
|
|
3
3
|
* Encapsulates field-level defaults, derivations, and validations.
|
|
4
4
|
* Operates only on in-memory SObject data — no SOQL or DML.
|
|
5
|
-
* @author Generated by Apex Class Writer Skill
|
|
6
5
|
*/
|
|
7
6
|
public with sharing class {SObject}Domain {
|
|
8
7
|
|
|
@@ -12,7 +11,7 @@ public with sharing class {SObject}Domain {
|
|
|
12
11
|
// ─── Field Defaults ──────────────────────────────────────────────────
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
|
-
*
|
|
14
|
+
* Applies default field values to new {SObject} records.
|
|
16
15
|
* Call this before insert to ensure consistent defaults.
|
|
17
16
|
* @param records List of {SObject} records to apply defaults to
|
|
18
17
|
*/
|
|
@@ -33,7 +32,7 @@ public with sharing class {SObject}Domain {
|
|
|
33
32
|
// ─── Derivations ────────────────────────────────────────────────────
|
|
34
33
|
|
|
35
34
|
/**
|
|
36
|
-
*
|
|
35
|
+
* Derives calculated field values based on other fields.
|
|
37
36
|
* Call this before insert and before update.
|
|
38
37
|
* @param records List of {SObject} records to derive values for
|
|
39
38
|
*/
|
|
@@ -52,7 +51,7 @@ public with sharing class {SObject}Domain {
|
|
|
52
51
|
// ─── Validations ────────────────────────────────────────────────────
|
|
53
52
|
|
|
54
53
|
/**
|
|
55
|
-
*
|
|
54
|
+
* Validates {SObject} records and adds errors for any violations.
|
|
56
55
|
* Call this before insert and before update.
|
|
57
56
|
* @param records List of {SObject} records to validate
|
|
58
57
|
*/
|
|
@@ -73,7 +72,7 @@ public with sharing class {SObject}Domain {
|
|
|
73
72
|
// ─── Comparisons ────────────────────────────────────────────────────
|
|
74
73
|
|
|
75
74
|
/**
|
|
76
|
-
*
|
|
75
|
+
* Determines which fields have changed between old and new record versions.
|
|
77
76
|
* Useful in before update context.
|
|
78
77
|
* @param oldRecord The previous version of the record
|
|
79
78
|
* @param newRecord The current version of the record
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Data Transfer Object for {describe the data this DTO represents}.
|
|
3
3
|
* Used to pass structured data between layers without exposing SObjects.
|
|
4
4
|
* Serialization-friendly for use with JSON.serialize/deserialize and API responses.
|
|
5
|
-
* @author Generated by Apex Class Writer Skill
|
|
6
5
|
*
|
|
7
6
|
* @example
|
|
8
7
|
* // Create from constructor
|
|
@@ -15,16 +14,16 @@ public with sharing class {ClassName} {
|
|
|
15
14
|
|
|
16
15
|
// ─── Properties ──────────────────────────────────────────────────────
|
|
17
16
|
|
|
18
|
-
/**
|
|
17
|
+
/** {Describe this property} */
|
|
19
18
|
public String name { get; set; }
|
|
20
19
|
|
|
21
|
-
/**
|
|
20
|
+
/** {Describe this property} */
|
|
22
21
|
public Id recordId { get; set; }
|
|
23
22
|
|
|
24
|
-
/**
|
|
23
|
+
/** {Describe this property} */
|
|
25
24
|
public Boolean isActive { get; set; }
|
|
26
25
|
|
|
27
|
-
/**
|
|
26
|
+
/** {Describe this property} */
|
|
28
27
|
public List<String> tags { get; set; }
|
|
29
28
|
|
|
30
29
|
// TODO: Add additional properties as needed
|
|
@@ -32,7 +31,7 @@ public with sharing class {ClassName} {
|
|
|
32
31
|
// ─── Constructors ────────────────────────────────────────────────────
|
|
33
32
|
|
|
34
33
|
/**
|
|
35
|
-
*
|
|
34
|
+
* No-arg constructor for deserialization compatibility
|
|
36
35
|
*/
|
|
37
36
|
public {ClassName}() {
|
|
38
37
|
this.tags = new List<String>();
|
|
@@ -40,7 +39,7 @@ public with sharing class {ClassName} {
|
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
/**
|
|
43
|
-
*
|
|
42
|
+
* Parameterized constructor for convenience
|
|
44
43
|
* @param name The name value
|
|
45
44
|
* @param recordId The associated record Id
|
|
46
45
|
*/
|
|
@@ -53,7 +52,7 @@ public with sharing class {ClassName} {
|
|
|
53
52
|
// ─── Factory Methods ─────────────────────────────────────────────────
|
|
54
53
|
|
|
55
54
|
/**
|
|
56
|
-
*
|
|
55
|
+
* Creates a DTO instance from an SObject record
|
|
57
56
|
* @param record The source {SObject} record
|
|
58
57
|
* @return A populated {ClassName} instance
|
|
59
58
|
*/
|
|
@@ -71,7 +70,7 @@ public with sharing class {ClassName} {
|
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
/**
|
|
74
|
-
*
|
|
73
|
+
* Creates a list of DTOs from a list of SObject records
|
|
75
74
|
* @param records The source records
|
|
76
75
|
* @return List of populated {ClassName} instances
|
|
77
76
|
*/
|
|
@@ -90,7 +89,7 @@ public with sharing class {ClassName} {
|
|
|
90
89
|
// ─── Utility Methods ─────────────────────────────────────────────────
|
|
91
90
|
|
|
92
91
|
/**
|
|
93
|
-
*
|
|
92
|
+
* Serializes this DTO to a JSON string
|
|
94
93
|
* @return JSON representation of this DTO
|
|
95
94
|
*/
|
|
96
95
|
public String toJson() {
|
|
@@ -98,7 +97,7 @@ public with sharing class {ClassName} {
|
|
|
98
97
|
}
|
|
99
98
|
|
|
100
99
|
/**
|
|
101
|
-
*
|
|
100
|
+
* Deserializes a JSON string into a {ClassName} instance
|
|
102
101
|
* @param jsonString The JSON string to deserialize
|
|
103
102
|
* @return A {ClassName} instance
|
|
104
103
|
*/
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Custom exception for {describe when this exception is thrown}.
|
|
3
3
|
* Use this exception to signal domain-specific errors that callers
|
|
4
4
|
* can catch and handle distinctly from system exceptions.
|
|
5
|
-
* @author Generated by Apex Class Writer Skill
|
|
6
5
|
*
|
|
7
6
|
* @example
|
|
8
7
|
* throw new {ClassName}('Account merge failed: duplicate detected.');
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Interface for {describe the capability or contract this interface defines}.
|
|
3
3
|
* Implement this interface to provide {describe what implementations do}.
|
|
4
|
-
* @author Generated by Apex Class Writer Skill
|
|
5
4
|
*
|
|
6
5
|
* @example
|
|
7
6
|
* public class EmailNotificationService implements {InterfaceName} {
|
|
@@ -13,7 +12,7 @@
|
|
|
13
12
|
public interface {InterfaceName} {
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
|
-
*
|
|
15
|
+
* {Describe what this method should do}
|
|
17
16
|
* @param params {Describe the parameter}
|
|
18
17
|
* @return {Describe the return value}
|
|
19
18
|
*/
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Invocable Apex action for {describe the action}.
|
|
3
|
+
* Callable from Flows, Process Builder, and Agentforce.
|
|
4
|
+
* Accepts bulkified List<Request>, returns List<Response>.
|
|
5
|
+
*/
|
|
6
|
+
public with sharing class {ClassName} {
|
|
7
|
+
|
|
8
|
+
// ─── Invocable Method ────────────────────────────────────────────────
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* {Describe what this action does}
|
|
12
|
+
* @param requests List of Request inputs from the calling Flow
|
|
13
|
+
* @return List of Response outputs returned to the calling Flow
|
|
14
|
+
*/
|
|
15
|
+
@InvocableMethod(
|
|
16
|
+
label='{Display Name}'
|
|
17
|
+
description='{Describe the action for Flow Builder}'
|
|
18
|
+
category='{Category}'
|
|
19
|
+
)
|
|
20
|
+
public static List<Response> execute(List<Request> requests) {
|
|
21
|
+
List<Response> responses = new List<Response>();
|
|
22
|
+
|
|
23
|
+
// Collect all Ids upfront for bulkified query
|
|
24
|
+
Set<Id> allRecordIds = new Set<Id>();
|
|
25
|
+
for (Request req : requests) {
|
|
26
|
+
if (req.recordId != null) {
|
|
27
|
+
allRecordIds.add(req.recordId);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Single bulkified query outside the loop
|
|
32
|
+
Map<Id, {SObject}> recordMap = allRecordIds.isEmpty()
|
|
33
|
+
? new Map<Id, {SObject}>()
|
|
34
|
+
: new Map<Id, {SObject}>([
|
|
35
|
+
SELECT Id, Name
|
|
36
|
+
// TODO: Add required fields
|
|
37
|
+
FROM {SObject}
|
|
38
|
+
WHERE Id IN :allRecordIds
|
|
39
|
+
WITH USER_MODE
|
|
40
|
+
]);
|
|
41
|
+
|
|
42
|
+
// Process each request
|
|
43
|
+
for (Request req : requests) {
|
|
44
|
+
responses.add(processRequest(req, recordMap));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return responses;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// ─── Private Helpers ─────────────────────────────────────────────────
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Processes a single request and returns a response.
|
|
54
|
+
* Errors are captured in the response, not thrown.
|
|
55
|
+
* @param req The input request
|
|
56
|
+
* @param recordMap Pre-queried records keyed by Id
|
|
57
|
+
* @return A Response with success/error information
|
|
58
|
+
*/
|
|
59
|
+
private static Response processRequest(Request req, Map<Id, {SObject}> recordMap) {
|
|
60
|
+
Response res = new Response();
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
{SObject} record = recordMap.get(req.recordId);
|
|
64
|
+
if (record == null) {
|
|
65
|
+
res.isSuccess = false;
|
|
66
|
+
res.errorMessage = 'Record not found: ' + req.recordId;
|
|
67
|
+
res.errorType = 'NOT_FOUND';
|
|
68
|
+
return res;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// TODO: Implement business logic
|
|
72
|
+
|
|
73
|
+
res.isSuccess = true;
|
|
74
|
+
} catch (Exception e) {
|
|
75
|
+
res.isSuccess = false;
|
|
76
|
+
res.errorMessage = e.getMessage();
|
|
77
|
+
res.errorType = e.getTypeName();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return res;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// ─── Request / Response DTOs ─────────────────────────────────────────
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Input parameters from the calling Flow
|
|
87
|
+
*/
|
|
88
|
+
public class Request {
|
|
89
|
+
@InvocableVariable(label='Record Id' description='The Id of the record to process' required=true)
|
|
90
|
+
public Id recordId;
|
|
91
|
+
|
|
92
|
+
// TODO: Add additional input variables
|
|
93
|
+
// @InvocableVariable(label='Field Value' description='Value to set' required=false)
|
|
94
|
+
// public String fieldValue;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Output results returned to the calling Flow
|
|
99
|
+
*/
|
|
100
|
+
public class Response {
|
|
101
|
+
@InvocableVariable(label='Success' description='Whether the action succeeded')
|
|
102
|
+
public Boolean isSuccess;
|
|
103
|
+
|
|
104
|
+
@InvocableVariable(label='Error Message' description='Error details if the action failed')
|
|
105
|
+
public String errorMessage;
|
|
106
|
+
|
|
107
|
+
@InvocableVariable(label='Error Type' description='Exception type name if the action failed')
|
|
108
|
+
public String errorType;
|
|
109
|
+
|
|
110
|
+
// TODO: Add additional output variables
|
|
111
|
+
// @InvocableVariable(label='Result Id' description='Id of the created/updated record')
|
|
112
|
+
// public Id resultId;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Queueable Apex class for {describe the async operation}.
|
|
3
3
|
* Accepts data through the constructor for stateful processing.
|
|
4
4
|
* Optionally implements Database.AllowsCallouts for external integrations.
|
|
5
|
-
* @author Generated by Apex Class Writer Skill
|
|
6
5
|
*
|
|
7
6
|
* @example
|
|
8
7
|
* // Enqueue the job
|
|
@@ -20,7 +19,7 @@ public with sharing class {ClassName} implements Queueable /*, Database.AllowsCa
|
|
|
20
19
|
// ─── Constructors ────────────────────────────────────────────────────
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
|
-
*
|
|
22
|
+
* Creates a new queueable job to process the specified records
|
|
24
23
|
* @param recordIds Set of record Ids to process
|
|
25
24
|
*/
|
|
26
25
|
public {ClassName}(Set<Id> recordIds) {
|
|
@@ -28,7 +27,7 @@ public with sharing class {ClassName} implements Queueable /*, Database.AllowsCa
|
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
/**
|
|
31
|
-
*
|
|
30
|
+
* Creates a new queueable job with chain depth tracking
|
|
32
31
|
* @param recordIds Set of record Ids to process
|
|
33
32
|
* @param chainDepth Current depth in the queueable chain
|
|
34
33
|
*/
|
|
@@ -40,7 +39,7 @@ public with sharing class {ClassName} implements Queueable /*, Database.AllowsCa
|
|
|
40
39
|
// ─── Queueable Interface ─────────────────────────────────────────────
|
|
41
40
|
|
|
42
41
|
/**
|
|
43
|
-
*
|
|
42
|
+
* Executes the asynchronous work
|
|
44
43
|
* @param context The queueable context
|
|
45
44
|
*/
|
|
46
45
|
public void execute(QueueableContext context) {
|
|
@@ -64,7 +63,7 @@ public with sharing class {ClassName} implements Queueable /*, Database.AllowsCa
|
|
|
64
63
|
// ─── Private Helpers ─────────────────────────────────────────────────
|
|
65
64
|
|
|
66
65
|
/**
|
|
67
|
-
*
|
|
66
|
+
* Chains to the next queueable job if needed, with depth guard
|
|
68
67
|
*/
|
|
69
68
|
private void chainIfNeeded() {
|
|
70
69
|
// TODO: Determine if chaining is needed (e.g., remaining records to process)
|
|
@@ -78,7 +77,7 @@ public with sharing class {ClassName} implements Queueable /*, Database.AllowsCa
|
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
/**
|
|
81
|
-
*
|
|
80
|
+
* Handles errors during execution
|
|
82
81
|
* @param jobId The async job Id
|
|
83
82
|
* @param e The exception that occurred
|
|
84
83
|
*/
|