@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental 1.111.0 → 1.112.0

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.
@@ -1,149 +0,0 @@
1
- ---
2
- name: exploring-graphql-schema
3
- description: Explore the Salesforce GraphQL schema via grep-only lookups. Use before generating any GraphQL query — schema exploration must complete first.
4
- paths:
5
- - "**/*.ts"
6
- - "**/*.tsx"
7
- - "**/*.graphql"
8
- ---
9
-
10
- # Salesforce GraphQL Schema Exploration
11
-
12
- Guidance for AI agents working with the Salesforce GraphQL API schema. **GREP ONLY** — the schema file is very large (~265,000+ lines). All lookups MUST use grep; do NOT open, read, stream, or parse the file.
13
-
14
- ## Deployment Prerequisites
15
-
16
- The schema reflects the **current org state**. Custom objects and fields appear only after metadata is deployed.
17
-
18
- - **Before** running `npm run graphql:schema`: Deploy all metadata (objects, permission sets, layouts) and assign the permission set to the target user. Invoke the `deploying-to-salesforce` skill for the full sequence.
19
- - **After** any metadata deployment: Re-run `npm run graphql:schema` and `npm run graphql:codegen` so types and queries stay in sync.
20
-
21
- ## Schema File Location
22
-
23
- **Location:** `schema.graphql` at the **SFDX project root** (NOT inside the webapp dir). All grep commands **must be run from the project root** where `schema.graphql` lives.
24
-
25
- > ⚠️ **Important (Access Policy - GREP ONLY)**: Do NOT open, view, stream, paginate, or parse the schema with any tool other than grep. All lookups MUST be done via grep using anchored patterns with minimal context as defined below.
26
-
27
- If the file is not present, generate it by running (from the **webapp dir**, not the project root):
28
-
29
- ```bash
30
- # Run from webapp dir (force-app/main/default/webapplications/<app-name>/)
31
- npm run graphql:schema
32
- ```
33
-
34
- **BEFORE generating any GraphQL query, you MUST:**
35
-
36
- 1. **Check if schema exists**: Look for `schema.graphql` in the **SFDX project root**
37
- 2. **If schema is missing**:
38
- - `cd` to the **webapp dir** and run `npm run graphql:schema` to download it
39
- - Wait for the command to complete successfully
40
- - Then proceed with grep-only lookups as defined below.
41
- 3. **If schema exists**: Proceed with targeted searches as described below
42
-
43
- > ⚠️ **DO NOT** generate GraphQL queries without first having access to the schema. Standard field assumptions may not match the target org's configuration.
44
-
45
- ## Schema Structure Overview
46
-
47
- Main entry points: `Query { uiapi }` for reads; `Mutation { uiapi(input: ...) }` for creates/updates/deletes. Record queries use `uiapi.query.<ObjectName>`.
48
-
49
- ## Allowed Lookups (grep-only)
50
-
51
- Use ONLY these grep commands to locate specific definitions in schema.graphql. Do not use editors (VS Code/vim/nano), cat/less/more/head/tail, or programmatic parsers (node/python/awk/sed/jq).
52
-
53
- - Always include:
54
- - `-n` (line numbers) and `-E` (extended regex)
55
- - Anchors (`^`) and word boundaries (`\b`)
56
- - Minimal context with `-A N` (prefer the smallest N that surfaces the needed lines)
57
-
58
- ### 1. Find Available Fields for a Record Type
59
-
60
- Search for `type <ObjectName> implements Record` to find all queryable fields:
61
-
62
- ```bash
63
- # Example: Find Account fields (anchored, minimal context)
64
- grep -nE '^type[[:space:]]+Account[[:space:]]+implements[[:space:]]+Record\b' ./schema.graphql -A 60
65
- ```
66
-
67
- ### 2. Find Filter Options for a Record Type
68
-
69
- Search for `input <ObjectName>_Filter` to find filterable fields and operators:
70
-
71
- ```bash
72
- # Example: Find Account filter options (anchored)
73
- grep -nE '^input[[:space:]]+Account_Filter\b' ./schema.graphql -A 40
74
- ```
75
-
76
- ### 3. Find OrderBy Options
77
-
78
- Search for `input <ObjectName>_OrderBy` for sorting options:
79
-
80
- ```bash
81
- # Example: Find Account ordering options (anchored)
82
- grep -nE '^input[[:space:]]+Account_OrderBy\b' ./schema.graphql -A 30
83
- ```
84
-
85
- ### 4. Find Mutation Operations
86
-
87
- Search for operations in `UIAPIMutations`:
88
-
89
- ```bash
90
- # Example: Find Account mutations (extended regex)
91
- grep -nE 'Account.*(Create|Update|Delete)' ./schema.graphql
92
- ```
93
-
94
- ### 5. Find Input Types for Mutations
95
-
96
- Search for `input <ObjectName>CreateInput` or `input <ObjectName>UpdateInput`:
97
-
98
- ```bash
99
- # Example: Find Account create input (anchored)
100
- grep -nE '^input[[:space:]]+AccountCreateInput\b' ./schema.graphql -A 30
101
- ```
102
-
103
- ## Agent Workflow for Building Queries (grep-only)
104
-
105
- **Pre-requisites (MANDATORY):**
106
-
107
- - [ ] Verified `schema.graphql` exists in the **SFDX project root**
108
- - [ ] If missing, ran `npm run graphql:schema` from the **webapp dir** and waited for completion
109
- - [ ] Confirmed connection to correct Salesforce org (if downloading fresh schema)
110
-
111
- **Workflow Steps:**
112
-
113
- 1. **Identify the target object** (e.g., Account, Contact, Opportunity)
114
- 2. **Run the "Find Available Fields" grep command** for your object (copy only the field names visible in the grep output; do not open the file)
115
- 3. **Run the "Find Filter Options" grep command** (`<Object>_Filter`) to understand filtering options
116
- 4. **Run the "Find OrderBy Options" grep command** (`<Object>_OrderBy`) for sorting capabilities
117
- 5. **Build the query** following the patterns in the `generating-graphql-read-query` or `generating-graphql-mutation-query` skill using only values returned by grep
118
- 6. **Validate field names** using grep matches (case-sensitive). Do not open or parse the file beyond grep.
119
-
120
- ## Tips for Agents
121
-
122
- - **Always verify field names** by running the specific grep commands; do not open the schema file
123
- - **Use grep with anchors and minimal -A context** to explore the schema efficiently—never read or stream the file
124
- - **Check relationships** by looking for `parentRelationship` and `childRelationship` comments in type definitions
125
- - **Look for Connection types** (e.g., `AccountConnection`) via grep to understand pagination structure
126
- - **Custom objects** end with `__c` (e.g., `CustomObject__c`)
127
- - **Custom fields** also end with `__c` (e.g., `Custom_Field__c`)
128
-
129
- ## Forbidden Operations
130
-
131
- To prevent accidental large reads, the following are prohibited for schema.graphql:
132
-
133
- - Opening in any editor (VS Code, vim, nano)
134
- - Using cat, less, more, head, or tail
135
- - Programmatic parsing (node, python, awk, sed, jq)
136
- - Streaming or paginating through large portions of the file
137
-
138
- If any of the above occurs, stop and replace the action with one of the Allowed Lookups (grep-only).
139
-
140
- ## Output Minimization
141
-
142
- - Prefer precise, anchored patterns with word boundaries
143
- - Use the smallest `-A` context that surfaces required lines
144
- - If results are noisy, refine the regex rather than increasing context
145
-
146
- ## Related Skills
147
-
148
- - For generating read queries, invoke the `generating-graphql-read-query` skill
149
- - For generating mutation queries, invoke the `generating-graphql-mutation-query` skill
@@ -1,167 +0,0 @@
1
- ---
2
- name: fetching-rest-api
3
- description: REST API usage via the Data SDK fetch method. Use when implementing Chatter, Connect REST, Apex REST, UI API REST, or Einstein LLM calls — only when GraphQL is not sufficient.
4
- paths:
5
- - "**/*.ts"
6
- - "**/*.tsx"
7
- - "**/*.graphql"
8
- ---
9
-
10
- # Salesforce REST API via Data SDK Fetch
11
-
12
- Use `sdk.fetch` from the Data SDK when GraphQL is not sufficient. The SDK applies authentication, CSRF handling, and base URL resolution. **Always use optional chaining** (`sdk.fetch?.()`) and handle the case where `fetch` is not available.
13
-
14
- Invoke this skill when you need to call Chatter, Connect REST, Apex REST, UI API REST, or Einstein LLM endpoints.
15
-
16
- ## API Version
17
-
18
- Use the project's API version. It is typically injected as `__SF_API_VERSION__`; fallback to `"65.0"`:
19
-
20
- ```typescript
21
- declare const __SF_API_VERSION__: string;
22
- const API_VERSION = typeof __SF_API_VERSION__ !== "undefined" ? __SF_API_VERSION__ : "65.0";
23
- ```
24
-
25
- ## Base Path
26
-
27
- URLs are relative to the Salesforce API base. The SDK prepends the correct base path. Use paths starting with `/services/...`.
28
-
29
- ---
30
-
31
- ## Chatter API
32
-
33
- User and collaboration data. No GraphQL equivalent.
34
-
35
- | Endpoint | Method | Purpose |
36
- | -------- | ------ | ------- |
37
- | `/services/data/v{version}/chatter/users/me` | GET | Current user (id, name, email, username) |
38
-
39
- ```typescript
40
- const sdk = await createDataSDK();
41
- const response = await sdk.fetch?.(`/services/data/v${API_VERSION}/chatter/users/me`);
42
-
43
- if (!response?.ok) throw new Error(`HTTP ${response?.status}`);
44
- const data = await response.json();
45
- return { id: data.id, name: data.name };
46
- ```
47
-
48
- ---
49
-
50
- ## Connect REST API
51
-
52
- File and content operations.
53
-
54
- | Endpoint | Method | Purpose |
55
- | -------- | ------ | ------- |
56
- | `/services/data/v{version}/connect/file/upload/config` | GET | Upload config (token, uploadUrl) for file uploads |
57
-
58
- ```typescript
59
- const sdk = await createDataSDK();
60
- const configRes = await sdk.fetch?.(`/services/data/v${API_VERSION}/connect/file/upload/config`, {
61
- method: "GET",
62
- });
63
-
64
- if (!configRes?.ok) throw new Error(`Failed to get upload config: ${configRes?.status}`);
65
- const config = await configRes.json();
66
- const { token, uploadUrl } = config;
67
- ```
68
-
69
- ---
70
-
71
- ## Apex REST
72
-
73
- Custom Apex REST resources. Requires corresponding Apex classes in the org. CSRF protection is applied automatically for `services/apexrest` URLs.
74
-
75
- | Endpoint | Method | Purpose |
76
- | -------- | ------ | ------- |
77
- | `/services/apexrest/auth/login` | POST | User login |
78
- | `/services/apexrest/auth/register` | POST | User registration |
79
- | `/services/apexrest/auth/forgot-password` | POST | Request password reset |
80
- | `/services/apexrest/auth/reset-password` | POST | Reset password with token |
81
- | `/services/apexrest/auth/change-password` | POST | Change password (authenticated) |
82
- | `/services/apexrest/{resource}` | GET/POST | Custom Apex REST resources |
83
-
84
- **Example (login):**
85
-
86
- ```typescript
87
- const sdk = await createDataSDK();
88
- const response = await sdk.fetch?.("/services/apexrest/auth/login", {
89
- method: "POST",
90
- body: JSON.stringify({ email, password, startUrl: "/" }),
91
- headers: { "Content-Type": "application/json", Accept: "application/json" },
92
- });
93
- ```
94
-
95
- Apex REST paths do not include the API version.
96
-
97
- ---
98
-
99
- ## UI API (REST)
100
-
101
- When GraphQL cannot cover the use case. **Prefer GraphQL** when possible.
102
-
103
- | Endpoint | Method | Purpose |
104
- | -------- | ------ | ------- |
105
- | `/services/data/v{version}/ui-api/records/{recordId}` | GET | Fetch a single record |
106
-
107
- ```typescript
108
- const sdk = await createDataSDK();
109
- const response = await sdk.fetch?.(`/services/data/v${API_VERSION}/ui-api/records/${recordId}`);
110
- ```
111
-
112
- ---
113
-
114
- ## Einstein LLM Gateway
115
-
116
- AI features. Requires Einstein API setup.
117
-
118
- | Endpoint | Method | Purpose |
119
- | -------- | ------ | ------- |
120
- | `/services/data/v{version}/einstein/llm/prompt/generations` | POST | Generate text from Einstein LLM |
121
-
122
- ```typescript
123
- const sdk = await createDataSDK();
124
- const response = await sdk.fetch?.(`/services/data/v${API_VERSION}/einstein/llm/prompt/generations`, {
125
- method: "POST",
126
- headers: { "Content-Type": "application/json" },
127
- body: JSON.stringify({
128
- additionalConfig: { applicationName: "PromptTemplateGenerationsInvocable" },
129
- promptTextorId: prompt,
130
- }),
131
- });
132
-
133
- if (!response?.ok) throw new Error(`Einstein LLM failed (${response?.status})`);
134
- const data = await response.json();
135
- return data?.generations?.[0]?.text ?? "";
136
- ```
137
-
138
- ---
139
-
140
- ## General Pattern
141
-
142
- ```typescript
143
- import { createDataSDK } from "@salesforce/sdk-data";
144
-
145
- const sdk = await createDataSDK();
146
-
147
- if (!sdk.fetch) {
148
- throw new Error("Data SDK fetch is not available in this context");
149
- }
150
-
151
- const response = await sdk.fetch(url, {
152
- method: "GET", // or POST, PUT, PATCH, DELETE
153
- headers: { "Content-Type": "application/json", Accept: "application/json" },
154
- body: method !== "GET" ? JSON.stringify(payload) : undefined,
155
- });
156
-
157
- if (!response.ok) throw new Error(`HTTP ${response.status}`);
158
- const data = await response.json();
159
- ```
160
-
161
- ---
162
-
163
- ## Reference
164
-
165
- - Parent: `accessing-data` — enforces Data SDK usage for all Salesforce data fetches
166
- - GraphQL: `using-graphql` — use for record queries and mutations when possible
167
- - `createRecord` from `@salesforce/webapp-experimental/api` for UI API record creation (uses SDK internally)
@@ -1,258 +0,0 @@
1
- ---
2
- name: generating-graphql-mutation-query
3
- description: Generate Salesforce GraphQL mutation queries. Use when the query to generate is a mutation query. Schema exploration must complete first — invoke exploring-graphql-schema first.
4
- paths:
5
- - "**/*.ts"
6
- - "**/*.tsx"
7
- - "**/*.graphql"
8
- ---
9
-
10
- # Salesforce GraphQL Mutation Query Generation
11
-
12
- **Triggering conditions**
13
-
14
- 1. Only if the schema exploration phase completed successfully (invoke `exploring-graphql-schema` first)
15
- 2. Only if the query to generate is a mutation query
16
-
17
- ## Schema Access Policy
18
-
19
- > ⚠️ **GREP ONLY** — During mutation generation you may need to verify field names, input types, or representations. All schema lookups **MUST** use the grep-only commands defined in the `exploring-graphql-schema` skill. Do NOT open, read, stream, or parse `./schema.graphql` with any tool other than grep.
20
-
21
- ## Your Role
22
-
23
- You are a GraphQL expert. Generate Salesforce-compatible mutation queries. Schema exploration must complete first. If the schema exploration has not been executed yet, you **MUST** run the full exploration workflow from the `exploring-graphql-schema` skill first, then return here for mutation query generation.
24
-
25
- ## Mutation Queries General Information
26
-
27
- The GraphQL engine supports `Create`, `Update`, and `Delete` operations. `Update` and `Delete` operate on Id-based entity identification. See the [mutation query schema](#mutation-query-schema) section.
28
-
29
- ## Mutation Query Generation Workflow
30
-
31
- Strictly follow the rules below when generating the GraphQL mutation query:
32
-
33
- 1. **Input Fields Validation** - Validate that the set of fields validate [input field constraints](#mutation-queries-input-field-constraints). Verify every field name and type against grep output from the schema — do NOT guess or assume
34
- 2. **Output Fields Validation** - Validate that the set of fields used in the select part of the query validate the [output fields constraints](#mutation-queries-output-field-constraints)
35
- 3. **Type Consistency** - Make sure variables used as query arguments and their related fields share the same GraphQL type. Verify types via grep lookup — do NOT assume types
36
- 4. **Report Phase** - Use the [Mutation Query Report Template](#mutation-query-report-template) below to report on the previous validation phases
37
- 5. **Input Arguments** - `input` is the default name for the argument, unless otherwise specified
38
- 6. **Output Field** - For `Create` and `Update` operations, the output field is always named `Record`, and is of type EntityName
39
- 7. **Field Name Validation** - Every field name in the generated mutation **MUST** match a field confirmed via grep lookup in the schema. Do NOT guess or assume field names exist
40
- 8. **Query Generation** - Use the [mutation query](#mutation-query-templates) template and adjust it based on the selected operation
41
- 9. **Output Format** - Use the [standalone](#mutation-standalone-default-output-format---clean-code-only)
42
- 10. **Lint Validation** - After writing the mutation to a file, run `npx eslint <file>` from the webapp dir to validate it against the schema. Fix any reported errors before proceeding. See [Lint Validation](#lint-validation) for details
43
- 11. **Test the Query** - Use the [Generated Mutation Query Testing](#generated-mutation-query-testing) workflow to test the generated query
44
- 1. **Report First** - Always output the generated mutation in the proper output format BEFORE initiating any test
45
-
46
- ## Mutation Query Schema
47
-
48
- **Important**: In the schema fragments below, replace **EntityName** occurrences by the real entity name (i.e. Account, Case...).
49
- **Important**: `Delete` operations all share the same generic `Record` entity name for both input and payload, only exposing the standard `Id` field.
50
-
51
- ```graphql
52
- input EntityNameCreateRepresentation {
53
- # Subset of EntityName fields here
54
- }
55
- input EntityNameCreateInput { EntityName: EntityNameCreateRepresentation! }
56
- type EntityNameCreatePayload { Record: EntityName! }
57
-
58
- input EntityNameUpdateRepresentation {
59
- # Subset of EntityName fields here
60
- }
61
- input EntityNameUpdateInput { Id: IdOrRef! EntityName: EntityNameUpdateRepresentation! }
62
- type EntityNameUpdatePayload { Record: EntityName! }
63
-
64
- input RecordDeleteInput { Id: IdOrRef! }
65
- type RecordDeletePayload { Id: ID }
66
-
67
- type UIAPIMutations {
68
- EntityNameCreate(input: EntityNameCreateInput!): EntityNameCreatePayload
69
- EntityNameDelete(input: RecordDeleteInput!): RecordDeletePayload
70
- EntityNameUpdate(input: EntityNameUpdateInput!): EntityNameUpdatePayload
71
- }
72
- ```
73
-
74
- ## Mutation Queries Input Field Constraints
75
-
76
- 1. **`Create` Mutation Queries**:
77
- 1. **MUST** include all required fields
78
- 2. **MUST** only include createable fields
79
- 3. Child relationships can't be set and **MUST** be excluded
80
- 4. Fields with type `REFERENCE` can only be assigned IDs through their `ApiName` name
81
- 2. **`Update` Mutation Queries**:
82
- 1. **MUST** include the id of the entity to update
83
- 2. **MUST** only include updateable fields
84
- 3. Child relationships can't be set and **MUST** be excluded
85
- 4. Fields with type `REFERENCE` can only be assigned IDs through their `ApiName` name
86
- 3. **`Delete` Mutation Queries**:
87
- 1. **MUST** include the id of the entity to delete
88
-
89
- ## Mutation Queries Output Field Constraints
90
-
91
- 1. **`Create` and `Update` Mutation Queries**:
92
- 1. **MUST** exclude all child relationships
93
- 2. **MUST** exclude all `REFERENCE` fields, unless accessed through their `ApiName` member (no navigation to referenced entity)
94
- 3. Inaccessible fields will be reported as part of the `errors` attribute in the returned payload
95
- 4. Child relationships **CAN'T** be queried as part of a mutation
96
- 5. Fields with type `REFERENCE` can only be queried through their `ApiName` (no referenced entities navigation, no sub fields)
97
- 2. **`Delete` Mutation Queries**:
98
- 1. **MUST** only include the `Id` field
99
-
100
- ## Mutation Query Report Template
101
-
102
- Input arguments:
103
-
104
- - Required fields: FieldName1 (Type1), FieldName2 (Type2)...
105
- - Other fields: FieldName3 (Type3)...
106
- Output fields: FieldNameA (TypeA), FieldNameB (TypeB)...
107
-
108
- ## Mutation Query Templates
109
-
110
- ```graphql
111
- mutation mutateEntityName(
112
- # arguments
113
- ) {
114
- uiapi {
115
- EntityNameOperation(input: {
116
- # the following is for `Create` and `Update` operations only
117
- EntityName: {
118
- # Input fields
119
- }
120
- # the following is for `Update` and `Delete` operations only
121
- Id: ... # id here
122
- }) {
123
- # the following is for `Create` and `Update` operations only
124
- Record {
125
- # Output fields
126
- }
127
- # the following is for `Delete` operations only
128
- Id: ... # id here
129
- }
130
- }
131
- }
132
- ```
133
-
134
- ## Mutation Standalone (Default) Output Format - CLEAN CODE ONLY
135
-
136
- ```javascript
137
- import { gql } from '@salesforce/sdk-data';
138
- const QUERY_NAME = gql`
139
- mutation mutateEntity($input: EntityNameOperationInput!) {
140
- uiapi {
141
- EntityNameOperation(input: $input) {
142
- # select output fields here depending on operation type
143
- }
144
- }
145
- }
146
- `;
147
-
148
- const QUERY_VARIABLES = {
149
- input: {
150
- // The following is for `Create` and `Update` operations only
151
- EntityName: {
152
- // variables here
153
- },
154
- // The following is for `Update` and `Delete` operations only
155
- Id: ... // id here
156
- }
157
- };
158
- ```
159
-
160
- **❌ FORBIDDEN — Do NOT include any of the following:**
161
-
162
- - Explanatory comments about the query (inline or surrounding)
163
- - Field descriptions or annotations
164
- - Additional text about what the query does
165
- - Workflow step descriptions or summaries
166
- - Comments like `// fetches...`, `// creates...`, `/* ... */`
167
-
168
- **✅ ONLY output:**
169
-
170
- - The raw query string constant (using `gql` tagged template)
171
- - The variables object constant
172
- - Nothing else — no extra imports, no exports, no wrapper functions
173
-
174
- ## Lint Validation
175
-
176
- After writing the generated mutation into a source file, validate it against the schema using the project's GraphQL ESLint setup:
177
-
178
- ```bash
179
- # Run from webapp dir (force-app/main/default/webapplications/<app-name>/)
180
- npx eslint <path-to-file-containing-mutation>
181
- ```
182
-
183
- **How it works:** The ESLint config uses `@graphql-eslint/eslint-plugin` with its `processor`, which extracts GraphQL operations from `gql` template literals in `.ts`/`.tsx` files and validates the extracted `.graphql` virtual files against `schema.graphql`.
184
-
185
- **Rules enforced:** `no-anonymous-operations`, `no-duplicate-fields`, `known-fragment-names`, `no-undefined-variables`, `no-unused-variables`
186
-
187
- **On failure:** Fix the reported issues, re-run `npx eslint <file>` until clean, then proceed to testing.
188
-
189
- > ⚠️ **Prerequisites**: The `schema.graphql` file must exist (invoke `exploring-graphql-schema` first) and project dependencies must be installed (`npm install`).
190
-
191
- ## Generated Mutation Query Testing
192
-
193
- **Triggering conditions** — **ALL conditions must be true:**
194
-
195
- 1. The [Mutation Query Generation Workflow](#mutation-query-generation-workflow) completed with status `SUCCESS` and you have a generated query
196
- 2. The query is a mutation query
197
- 3. A non-manual method was used during schema exploration to retrieve introspection data
198
-
199
- **Workflow**
200
-
201
- 1. **Report Step** - State the exact method you will use to test (e.g., `sf api request graphql` from the **project root**, Connect API, etc.) — this **MUST** match the method used during schema exploration
202
- 2. **Interactive Step** - Ask the user whether they want you to test the query using the proposed method
203
- 1. **STOP and WAIT** for the user's answer. Do NOT proceed until the user responds. Do NOT assume consent.
204
- 3. **Input Arguments** - You **MUST** ask the user for the input argument values to use in the test
205
- 1. **STOP and WAIT** for the user's answer. Do NOT proceed until the user provides values. Do NOT fabricate test data.
206
- 4. **Test Query** - Only if the user explicitly agrees and has provided input values:
207
- 1. Execute the mutation using the reported method (e.g., `sf api request rest` to POST the query and variables to the GraphQL endpoint):
208
- ```bash
209
- sf api request rest /services/data/v65.0/graphql \
210
- --method POST \
211
- --body '{"query":"mutation mutateEntity($input: EntityNameOperationInput!) { uiapi { EntityNameOperation(input: $input) { Record { Id } } } }","variables":{"input":{"EntityName":{"Field":"Value"}}}}'
212
- ```
213
- 2. Replace `v65.0` with the API version of the target org
214
- 3. Replace the `query` value with the generated mutation query string
215
- 4. Replace the `variables` value with the user-provided input arguments
216
- 5. **Result Analysis** - Retrieve the `data` and `errors` attributes from the returned payload, and report the result of the test as one of the following options:
217
- 1. `PARTIAL` if `data` is not an empty object, but `errors` is not an empty list - Explanation: some of the queried fields are not accessible on mutations
218
- 2. `FAILED` if `data` is an empty object - Explanation: the query is not valid
219
- 3. `SUCCESS` if `errors` is an empty list
220
- 6. **Remediation Step** - If status is not `SUCCESS`, use the [`FAILED`](#failed-status-handling-workflow) or [`PARTIAL`](#partial-status-handling-workflow) status handling workflows
221
-
222
- ### `FAILED` Status Handling Workflow
223
-
224
- The query is invalid:
225
-
226
- 1. **Error Analysis** - Parse and categorize the specific error messages
227
- 2. **Root Cause Identification** - Use error message to identify the root cause:
228
- - **Execution** - Error contains `invalid cross reference id` or `entity is deleted`
229
- - **Syntax** - Error contains `invalid syntax`
230
- - **Validation** - Error contains `validation error`
231
- - **Type** - Error contains `VariableTypeMismatch` or `UnknownType`
232
- - **Navigation** - Error contains `is not currently available in mutation results`
233
- - **API Version** - Query deals with updates, you're testing with Connect API and error contains `Cannot invoke JsonElement.isJsonObject()`
234
- 3. **Targeted Resolution** - Depending on the root cause categorization
235
- - **Execution** - You're trying to update or delete an unknown/no longer available entity: either create an entity first, if you have generated the related query, or ask for a valid entity id to use. **STOP and WAIT** for the user to provide a valid Id
236
- - **Syntax** - Update the query using the error message information to fix the syntax errors
237
- - **Validation** - The field name is most probably invalid. Re-run the relevant grep command from the `exploring-graphql-schema` skill to verify the correct field name. If still unclear, ask the user for clarification and **STOP and WAIT** for their answer
238
- - **Type** - Use the error details and re-verify the type via grep lookup in the schema. Correct the argument type and adjust variables accordingly
239
- - **Navigation** - Use the [`PARTIAL` status handling workflow](#partial-status-handling-workflow) below
240
- - **API Version** - `Record` selection is only available with API version 64 and higher, **report** the issue, and try again with API version 64
241
- 4. **Test Again** - Resume the [query testing workflow](#generated-mutation-query-testing) with the updated query (increment and track attempt counter)
242
- 5. **Escalation Path** - If targeted resolution fails after 2 attempts, ask for additional details and restart the entire GraphQL workflow from the `exploring-graphql-schema` skill
243
-
244
- ### `PARTIAL` Status Handling Workflow
245
-
246
- The query can be improved:
247
-
248
- 1. Report the fields mentioned in the `errors` list
249
- 2. Explain that these fields can't be queried as part of a mutation query
250
- 3. Explain that the query might be considered as failing, as it will report errors
251
- 4. Offer to remove the offending fields
252
- 5. **STOP and WAIT** for the user's answer. Do NOT remove fields without explicit consent.
253
- 6. If they are OK with removing the fields restart the [generation workflow](#mutation-query-generation-workflow) with the new field list
254
-
255
- ## Related Skills
256
-
257
- - Schema exploration: `exploring-graphql-schema` (must complete first)
258
- - Read query generation: `generating-graphql-read-query`